Merge branch 'develop' into payment-terms
diff --git a/.travis.yml b/.travis.yml
index 80d979f..cae50cb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -51,11 +51,14 @@
   - bench start &
   - sleep 10
 
-script:
-  - set -e
-  - bench run-tests
-  - sleep 5
-  - bench reinstall --yes
-  - bench --verbose run-setup-wizard-ui-test
-  - bench execute erpnext.setup.utils.enable_all_roles_and_domains
-  - bench run-ui-tests --app erpnext
+jobs:
+  include:
+    - stage: test
+      script:
+        - set -e
+        - bench run-tests
+    - # stage
+      script:
+        - bench --verbose run-setup-wizard-ui-test
+        - bench execute erpnext.setup.utils.enable_all_roles_and_domains
+        - bench run-ui-tests --app erpnext
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 1c9b0b4..61381b2 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -4,7 +4,7 @@
 import frappe
 from erpnext.hooks import regional_overrides
 
-__version__ = '8.11.2'
+__version__ = '8.11.4'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 304af37..47e214e 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -36,7 +36,7 @@
 		validate_balance_type(self.account, adv_adj)
 
 		# Update outstanding amt on against voucher
-		if self.against_voucher_type in ['Journal Entry', 'Sales Invoice', 'Purchase Invoice'] \
+		if self.against_voucher_type in ['Journal Entry', 'Sales Invoice', 'Purchase Invoice', 'Fees'] \
 			and self.against_voucher and update_outstanding == 'Yes' and not from_repost:
 				update_outstanding_amt(self.account, self.party_type, self.party, self.against_voucher_type,
 					self.against_voucher)
@@ -196,7 +196,7 @@
 			frappe.throw(_("Outstanding for {0} cannot be less than zero ({1})").format(against_voucher, fmt_money(bal)))
 
 	# Update outstanding amt on against voucher
-	if against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
+	if against_voucher_type in ["Sales Invoice", "Purchase Invoice", "Fees"]:
 		ref_doc = frappe.get_doc(against_voucher_type, against_voucher)
 		ref_doc.db_set('outstanding_amount', bal)
 		ref_doc.set_status(update=True)
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index dc37574..61ede97 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -12,7 +12,8 @@
 
 	setup: function(frm) {
 		frm.set_query("paid_from", function() {
-			var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
+			var party_account_type = in_list(["Customer", "Student"], frm.doc.party_type) ?
+				"Receivable" : "Payable";
 			var account_types = in_list(["Pay", "Internal Transfer"], frm.doc.payment_type) ?
 				["Bank", "Cash"] : party_account_type;
 
@@ -28,13 +29,14 @@
 		frm.set_query("party_type", function() {
 			return{
 				"filters": {
-					"name": ["in",["Customer","Supplier", "Employee"]],
+					"name": ["in",["Customer","Supplier", "Employee", "Student"]],
 				}
 			}
 		});
 
 		frm.set_query("paid_to", function() {
-			var party_account_type = frm.doc.party_type=="Customer" ? "Receivable" : "Payable";
+			var party_account_type = in_list(["Customer", "Student"], frm.doc.party_type) ?
+				"Receivable" : "Payable";
 			var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ?
 				["Bank", "Cash"] : party_account_type;
 
@@ -72,6 +74,8 @@
 				var doctypes = ["Purchase Order", "Purchase Invoice", "Journal Entry"];
 			} else if (frm.doc.party_type=="Employee") {
 				var doctypes = ["Expense Claim", "Journal Entry"];
+			} else if (frm.doc.party_type=="Student") {
+				var doctypes = ["Fees"];
 			} else {
 				var doctypes = ["Journal Entry"];
 			}
@@ -85,7 +89,7 @@
 			child = locals[cdt][cdn];
 			filters = {"docstatus": 1, "company": doc.company};
 			party_type_doctypes = ['Sales Invoice', 'Sales Order', 'Purchase Invoice', 
-				'Purchase Order', 'Expense Claim'];
+				'Purchase Order', 'Expense Claim', 'Fees'];
 
 			if (in_list(party_type_doctypes, child.reference_doctype)) {
 				filters[doc.party_type.toLowerCase()] = doc.party;
@@ -207,19 +211,13 @@
 				frm.set_value(field, null);
 			});
 		} else {
-			if(!frm.doc.party)
-			{
-				if (frm.doc.payment_type=="Receive"){
-					frm.set_value("party_type", "Customer");
-				}
-			}
-			else
-			{
-				frm.events.party(frm);
+			if(frm.doc.party) {
+				frm.events.party(frm);	
 			}
 
-			if(frm.doc.mode_of_payment)
+			if(frm.doc.mode_of_payment) {
 				frm.events.mode_of_payment(frm);
+			}
 		}
 	},
 
@@ -254,6 +252,7 @@
 					date: frm.doc.posting_date
 				},
 				callback: function(r, rt) {
+					console.log(r, rt);
 					if(r.message) {
 						if(frm.doc.payment_type == "Receive") {
 							frm.set_value("paid_from", r.message.party_account);
@@ -502,6 +501,8 @@
 						c.due_date = d.due_date
 						c.total_amount = d.invoice_amount;
 						c.outstanding_amount = d.outstanding_amount;
+						c.bill_no = d.bill_no;
+
 						if(!in_list(["Sales Order", "Purchase Order", "Expense Claim"], d.voucher_type)) {
 							if(flt(d.outstanding_amount) > 0)
 								total_positive_outstanding += flt(d.outstanding_amount);
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 7ae9bde..195a27f 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -100,8 +100,8 @@
 			if not self.party:
 				frappe.throw(_("Party is mandatory"))
 
-			self.party_name = frappe.db.get_value(self.party_type, self.party,
-				self.party_type.lower() + "_name")
+			_party_name = "title" if self.party_type == "Student" else self.party_type.lower() + "_name"
+			self.party_name = frappe.db.get_value(self.party_type, self.party, _party_name)
 
 		if self.party:
 			if not self.party_balance:
@@ -149,7 +149,7 @@
 				frappe.throw(_("Invalid {0}: {1}").format(self.party_type, self.party))
 
 			if self.party_account:
-				party_account_type = "Receivable" if self.party_type=="Customer" else "Payable"
+				party_account_type = "Receivable" if self.party_type in ("Customer", "Student") else "Payable"
 				self.validate_account_type(self.party_account, [party_account_type])
 
 	def validate_bank_accounts(self):
@@ -182,7 +182,9 @@
 				frappe.throw(_("{0} is mandatory").format(self.meta.get_label(field)))
 
 	def validate_reference_documents(self):
-		if self.party_type == "Customer":
+		if self.party_type == "Student":
+			valid_reference_doctypes = ("Fees")
+		elif self.party_type == "Customer":
 			valid_reference_doctypes = ("Sales Order", "Sales Invoice", "Journal Entry")
 		elif self.party_type == "Supplier":
 			valid_reference_doctypes = ("Purchase Order", "Purchase Invoice", "Journal Entry")
@@ -209,15 +211,17 @@
 					else:
 						self.validate_journal_entry()
 
-					if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim"):
-						if self.party_type=="Customer":
+					if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim", "Fees"):
+						if self.party_type == "Customer":
 							ref_party_account = ref_doc.debit_to
+						elif self.party_type == "Student":
+							ref_party_account = ref_doc.receivable_account
 						elif self.party_type=="Supplier":
 							ref_party_account = ref_doc.credit_to
 						elif self.party_type=="Employee":
 							ref_party_account = ref_doc.payable_account
 
-						if ref_party_account != self.party_account:
+					if ref_party_account != self.party_account:
 							frappe.throw(_("{0} {1} is associated with {2}, but Party Account is {3}")
 								.format(d.reference_doctype, d.reference_name, ref_party_account, self.party_account))
 
@@ -398,7 +402,7 @@
 				"account_currency": self.party_account_currency
 			})
 
-			dr_or_cr = "credit" if self.party_type == "Customer" else "debit"
+			dr_or_cr = "credit" if self.party_type in ["Customer", "Student"] else "debit"
 
 			for d in self.get("references"):
 				gle = party_gl_dict.copy()
@@ -484,9 +488,14 @@
 					doc = frappe.get_doc("Expense Claim", d.reference_name)
 					update_reimbursed_amount(doc)
 
+	def on_recurring(self, reference_doc, subscription_doc):
+		self.reference_no = reference_doc.name
+		self.reference_date = nowdate()
+
 @frappe.whitelist()
 def get_outstanding_reference_documents(args):
-	args = json.loads(args)
+	if isinstance(args, basestring):
+		args = json.loads(args)
 
 	party_account_currency = get_account_currency(args.get("party_account"))
 	company_currency = frappe.db.get_value("Company", args.get("company"), "default_currency")
@@ -494,10 +503,12 @@
 	# Get negative outstanding sales /purchase invoices
 	total_field = "base_grand_total" if party_account_currency == company_currency else "grand_total"
 
-	negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"),
-		args.get("party"), args.get("party_account"), total_field)
+	negative_outstanding_invoices = []
+	if (args.get("party_type") != "Student"):
+		negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"),
+			args.get("party"), args.get("party_account"), total_field)
 
-	# Get positive outstanding sales /purchase invoices
+	# Get positive outstanding sales /purchase invoices/ Fees
 	outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"),
 		args.get("party_account"))
 
@@ -510,10 +521,14 @@
 				d["exchange_rate"] = get_exchange_rate(
 					party_account_currency,	company_currency, d.posting_date
 				)
+		if d.voucher_type in ("Purchase Invoice"):
+			d["bill_no"] = frappe.db.get_value(d.voucher_type, d.voucher_no, "bill_no")
 
 	# Get all SO / PO which are not fully billed or aginst which full advance not paid
-	orders_to_be_billed =  get_orders_to_be_billed(args.get("posting_date"),args.get("party_type"), args.get("party"),
-		party_account_currency, company_currency)
+	orders_to_be_billed = []
+	if (args.get("party_type") != "Student"):
+		orders_to_be_billed =  get_orders_to_be_billed(args.get("posting_date"),args.get("party_type"),
+			args.get("party"), party_account_currency, company_currency)
 
 	return negative_outstanding_invoices + outstanding_invoices + orders_to_be_billed
 
@@ -628,7 +643,11 @@
 	total_amount = outstanding_amount = exchange_rate = None
 	ref_doc = frappe.get_doc(reference_doctype, reference_name)
 
-	if reference_doctype != "Journal Entry":
+	if reference_doctype == "Fees":
+		total_amount = ref_doc.get("grand_total")
+		exchange_rate = 1
+		outstanding_amount = ref_doc.get("outstanding_amount")
+	elif reference_doctype != "Journal Entry":
 		if party_account_currency == ref_doc.company_currency:
 			if ref_doc.doctype == "Expense Claim":
 				total_amount = ref_doc.total_sanctioned_amount
@@ -671,19 +690,23 @@
 		party_type = "Supplier"
 	elif dt in ("Expense Claim"):
 		party_type = "Employee"
+	elif dt in ("Fees"):
+		party_type = "Student"
 
 	# party account
 	if dt == "Sales Invoice":
 		party_account = doc.debit_to
 	elif dt == "Purchase Invoice":
 		party_account = doc.credit_to
+	elif dt == "Fees":
+		party_account = doc.receivable_account
 	else:
 		party_account = get_party_account(party_type, doc.get(party_type.lower()), doc.company)
 
 	party_account_currency = doc.get("party_account_currency") or get_account_currency(party_account)
 
 	# payment type
-	if (dt == "Sales Order" or (dt=="Sales Invoice" and doc.outstanding_amount > 0)) \
+	if (dt == "Sales Order" or (dt in ("Sales Invoice", "Fees") and doc.outstanding_amount > 0)) \
 		or (dt=="Purchase Invoice" and doc.outstanding_amount < 0):
 			payment_type = "Receive"
 	else:
@@ -699,6 +722,9 @@
 	elif dt in ("Expense Claim"):
 		grand_total = doc.total_sanctioned_amount
 		outstanding_amount = doc.total_sanctioned_amount - doc.total_amount_reimbursed
+	elif dt == "Fees":
+		grand_total = doc.grand_total
+		outstanding_amount = doc.outstanding_amount
 	else:
 		total_field = "base_grand_total" if party_account_currency == doc.company_currency else "grand_total"
 		grand_total = flt(doc.get(total_field))
diff --git a/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js b/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js
index 7dea76d..4f27b74 100644
--- a/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js
+++ b/erpnext/accounts/doctype/payment_entry/tests/test_payment_against_invoice.js
@@ -9,9 +9,9 @@
 				{customer: 'Test Customer 1'},
 				{items: [
 					[
+						{'item_code': 'Test Product 1'},
 						{'qty': 1},
 						{'rate': 101},
-						{'item_code': 'Test Product 1'},
 					]
 				]}
 			]);
@@ -19,11 +19,12 @@
 		() => cur_frm.save(),
 		() => frappe.tests.click_button('Submit'),
 		() => frappe.tests.click_button('Yes'),
-		() => frappe.timeout(0.5),
+		() => frappe.timeout(1),
 		() => frappe.tests.click_button('Close'),
-		() => frappe.timeout(0.5),
+		() => frappe.timeout(1),
 		() => frappe.click_button('Make'),
-		() => frappe.click_link('Payment', 1),
+		() => frappe.timeout(1),
+		() => frappe.click_link('Payment'),
 		() => frappe.timeout(2),
 		() => {
 			assert.equal(frappe.get_route()[1], 'Payment Entry',
@@ -35,16 +36,19 @@
 			assert.equal(cur_frm.doc.references[0].allocated_amount, 101,
 				'amount allocated against sales invoice');
 		},
+		() => frappe.timeout(1),
 		() => cur_frm.set_value('paid_amount', 100),
+		() => frappe.timeout(1),
 		() => {
-			cur_frm.doc.references[0].allocated_amount = 101;
+			frappe.model.set_value("Payment Entry Reference", cur_frm.doc.references[0].name,
+				"allocated_amount", 101);
 		},
+		() => frappe.timeout(1),
 		() => frappe.click_button('Write Off Difference Amount'),
+		() => frappe.timeout(1),
 		() => {
-			assert.equal(cur_frm.doc.difference_amount, 0,
-				'difference amount is zero');
-			assert.equal(cur_frm.doc.deductions[0].amount, 1,
-				'Write off amount = 1');
+			assert.equal(cur_frm.doc.difference_amount, 0, 'difference amount is zero');
+			assert.equal(cur_frm.doc.deductions[0].amount, 1, 'Write off amount = 1');
 		},
 		() => done()
 	]);
diff --git a/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js b/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js
index 133f136..9849d76 100644
--- a/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js
+++ b/erpnext/accounts/doctype/payment_entry/tests/test_payment_entry_write_off.js
@@ -7,7 +7,7 @@
 		() => {
 			return frappe.tests.make('Sales Invoice', [
 				{customer: 'Test Customer 1'},
-				{company: '_Test Company'},
+				{company: 'For Testing'},
 				{currency: 'INR'},
 				{selling_price_list: '_Test Price List'},
 				{items: [
@@ -29,12 +29,12 @@
 		() => frappe.timeout(1),
 		() => frappe.click_link('Payment'),
 		() => frappe.timeout(2),
-		() => cur_frm.set_value("paid_to", "_Test Cash - _TC"),
+		() => cur_frm.set_value("paid_to", "_Test Cash - FT"),
 		() => frappe.timeout(0.5),
 		() => {
 			assert.equal(frappe.get_route()[1], 'Payment Entry', 'made payment entry');
 			assert.equal(cur_frm.doc.party, 'Test Customer 1', 'customer set in payment entry');
-			assert.equal(cur_frm.doc.paid_from, 'Debtors - _TC', 'customer account set in payment entry');
+			assert.equal(cur_frm.doc.paid_from, 'Debtors - FT', 'customer account set in payment entry');
 			assert.equal(cur_frm.doc.paid_amount, 100, 'paid amount set in payment entry');
 			assert.equal(cur_frm.doc.references[0].allocated_amount, 100,
 				'amount allocated against sales invoice');
@@ -50,10 +50,10 @@
 			assert.equal(cur_frm.doc.difference_amount, 5, 'difference amount is 5');
 		},
 		() => {
-			frappe.db.set_value("Company", "_Test Company", "write_off_account", "_Test Write Off - _TC");
+			frappe.db.set_value("Company", "For Testing", "write_off_account", "_Test Write Off - FT");
 			frappe.timeout(1);
-			frappe.db.set_value("Company", "_Test Company",
-				"exchange_gain_loss_account", "_Test Exchange Gain/Loss - _TC");
+			frappe.db.set_value("Company", "For Testing",
+				"exchange_gain_loss_account", "_Test Exchange Gain/Loss - FT");
 		},
 		() => frappe.timeout(1),
 		() => frappe.click_button('Write Off Difference Amount'),
diff --git a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
index 8104e9b..da17bb3 100644
--- a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
+++ b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
  "beta": 0, 
@@ -12,6 +13,7 @@
  "engine": "InnoDB", 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -42,6 +44,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -72,6 +75,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -101,6 +105,38 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "bill_no", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Supplier Invoice No", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -129,6 +165,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -158,6 +195,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -187,6 +225,7 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -216,10 +255,12 @@
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "depends_on": "eval:(doc.reference_doctype=='Purchase Invoice')", 
    "fieldname": "exchange_rate", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -245,17 +286,17 @@
    "unique": 0
   }
  ], 
+ "has_web_view": 0, 
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "idx": 0, 
  "image_view": 0, 
  "in_create": 0, 
- "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-02-17 16:47:17.156256", 
+ "modified": "2017-09-04 17:37:01.192312", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Entry Reference", 
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 44a3644..807ad28 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -35,7 +35,6 @@
 
 	def on_submit(self):
 		send_mail = True
-		self.make_communication_entry()
 		ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
 
 		if (hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart") \
@@ -45,6 +44,7 @@
 		if send_mail:
 			self.set_payment_request_url()
 			self.send_email()
+			self.make_communication_entry()
 
 	def on_cancel(self):
 		self.check_if_payment_entry_exists()
@@ -69,8 +69,11 @@
 			self.db_set('status', 'Initiated')
 
 	def get_payment_url(self):
-		data = frappe.db.get_value(self.reference_doctype, self.reference_name,
-			["company", "customer_name"], as_dict=1)
+		if self.reference_doctype != "Fees":
+			data = frappe.db.get_value(self.reference_doctype, self.reference_name, ["company", "customer_name"], as_dict=1)
+		else:
+			data = frappe.db.get_value(self.reference_doctype, self.reference_name, ["student_name"], as_dict=1)
+			data.update({"company": frappe.defaults.get_defaults().company})
 
 		controller = get_payment_gateway_controller(self.payment_gateway)
 		controller.validate_transaction_currency(self.currency)
@@ -277,6 +280,9 @@
 		else:
 			grand_total = flt(ref_doc.outstanding_amount) / ref_doc.conversion_rate
 
+	if dt == "Fees":
+		grand_total = ref_doc.outstanding_amount
+
 	if grand_total > 0 :
 		return grand_total
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 066809e..fb28d13 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -2078,6 +2078,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -2172,6 +2203,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "in_words", 
    "fieldtype": "Data", 
    "hidden": 0, 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 180ad89..a564d92 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -15,6 +15,7 @@
 from erpnext.accounts.general_ledger import make_gl_entries, merge_similar_entries, delete_gl_entries
 from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
 from erpnext.buying.utils import check_for_closed_status
+from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
 
 form_grid_templates = {
 	"items": "templates/form_grid/item_grid.html"
@@ -353,6 +354,7 @@
 
 		self.make_payment_gl_entries(gl_entries)
 		self.make_write_off_gl_entry(gl_entries)
+		self.make_gle_for_rounding_adjustment(gl_entries)
 
 		return gl_entries
 
@@ -604,6 +606,21 @@
 				})
 			)
 
+	def make_gle_for_rounding_adjustment(self, gl_entries):
+		if self.rounding_adjustment:
+			round_off_account, round_off_cost_center = \
+				get_round_off_account_and_cost_center(self.company)
+
+			gl_entries.append(
+				self.get_gl_dict({
+					"account": round_off_account,
+					"against": self.supplier,
+					"debit_in_account_currency": self.rounding_adjustment,
+					"debit": self.base_rounding_adjustment,
+					"cost_center": round_off_cost_center,
+				}
+			))
+
 	def on_cancel(self):
 		self.check_for_closed_status()
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index f1ba18c..25f2426 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -1676,36 +1676,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "net_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Net Total", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1737,6 +1707,36 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "net_total", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Net Total", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2343,6 +2343,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2466,6 +2497,37 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 3f8a1fb..678988d 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -20,6 +20,7 @@
 from erpnext.stock.doctype.batch.batch import set_batch_nos
 from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delivery_note_serial_no
 from erpnext.setup.doctype.company.company import update_company_current_month_sales
+from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
 
 form_grid_templates = {
 	"items": "templates/form_grid/item_grid.html"
@@ -625,6 +626,7 @@
 		self.make_gle_for_change_amount(gl_entries)
 
 		self.make_write_off_gl_entry(gl_entries)
+		self.make_gle_for_rounding_adjustment(gl_entries)
 
 		return gl_entries
 
@@ -804,6 +806,21 @@
 				}, write_off_account_currency)
 			)
 
+	def make_gle_for_rounding_adjustment(self, gl_entries):
+		if self.rounding_adjustment:
+			round_off_account, round_off_cost_center = \
+				get_round_off_account_and_cost_center(self.company)
+
+			gl_entries.append(
+				self.get_gl_dict({
+					"account": round_off_account,
+					"against": self.customer,
+					"credit_in_account_currency": self.rounding_adjustment,
+					"credit": self.base_rounding_adjustment,
+					"cost_center": round_off_cost_center,
+				}
+			))
+
 	def update_billing_status_in_dn(self, update_modified=True):
 		updated_delivery_notes = []
 		for d in self.get("items"):
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 60e1dbc..da33a78 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -224,12 +224,12 @@
 		si.save()
 
 		# with inclusive tax and additional discount
-		self.assertEquals(si.net_total, 4298.24)
+		self.assertEquals(si.net_total, 4298.25)
 		self.assertEquals(si.grand_total, 4900.00)
 
 	def test_sales_invoice_discount_amount(self):
 		si = frappe.copy_doc(test_records[3])
-		si.discount_amount = 104.95
+		si.discount_amount = 104.94
 		si.append("taxes", {
 			"charge_type": "On Previous Row Amount",
 			"account_head": "_Test Account Service Tax - _TC",
@@ -294,7 +294,7 @@
 			"_Test Account Customs Duty - _TC": [125, 116.35, 1585.40],
 			"_Test Account Shipping Charges - _TC": [100, 100, 1685.40],
 			"_Test Account Discount - _TC": [-180.33, -168.54, 1516.86],
-			"_Test Account Service Tax - _TC": [-18.03, -16.86, 1500]
+			"_Test Account Service Tax - _TC": [-18.03, -16.85, 1500.01]
 		}
 
 		for d in si.get("taxes"):
@@ -303,10 +303,12 @@
 
 		self.assertEquals(si.base_grand_total, 1500)
 		self.assertEquals(si.grand_total, 1500)
+		self.assertEquals(si.rounding_adjustment, -0.01)
 
 	def test_discount_amount_gl_entry(self):
+		frappe.db.set_value("Company", "_Test Company", "round_off_account", "Round Off - _TC")
 		si = frappe.copy_doc(test_records[3])
-		si.discount_amount = 104.95
+		si.discount_amount = 104.94
 		si.append("taxes", {
 			"doctype": "Sales Taxes and Charges",
 			"charge_type": "On Previous Row Amount",
@@ -336,7 +338,8 @@
 			[test_records[3]["taxes"][5]["account_head"], 0.0, 116.35],
 			[test_records[3]["taxes"][6]["account_head"], 0.0, 100],
 			[test_records[3]["taxes"][7]["account_head"], 168.54, 0.0],
-			["_Test Account Service Tax - _TC", 16.86, 0.0]
+			["_Test Account Service Tax - _TC", 16.85, 0.0],
+			["Round Off - _TC", 0.01, 0.0]
 		])
 
 		for gle in gl_entries:
@@ -432,13 +435,12 @@
 		expected_values = {
 			"keys": ["price_list_rate", "discount_percentage", "rate", "amount",
 				"base_price_list_rate", "base_rate", "base_amount", "net_rate", "net_amount"],
-			"_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 62.5, 62.5, 625.0, 50, 499.98],
-			"_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 190.66, 190.66, 953.3, 150, 750],
+			"_Test Item Home Desktop 100": [62.5, 0, 62.5, 625.0, 62.5, 62.5, 625.0, 50, 499.97600115194473],
+			"_Test Item Home Desktop 200": [190.66, 0, 190.66, 953.3, 190.66, 190.66, 953.3, 150, 749.9968530500239],
 		}
 
 		# check if children are saved
-		self.assertEquals(len(si.get("items")),
-			len(expected_values)-1)
+		self.assertEquals(len(si.get("items")), len(expected_values)-1)
 
 		# check if item values are calculated
 		for d in si.get("items"):
@@ -446,28 +448,28 @@
 				self.assertEquals(d.get(k), expected_values[d.item_code][i])
 
 		# check net total
-		self.assertEquals(si.base_net_total, 1249.98)
+		self.assertEquals(si.net_total, 1249.97)
 		self.assertEquals(si.total, 1578.3)
 
 		# check tax calculation
 		expected_values = {
 			"keys": ["tax_amount", "total"],
-			"_Test Account Excise Duty - _TC": [140, 1389.98],
-			"_Test Account Education Cess - _TC": [2.8, 1392.78],
-			"_Test Account S&H Education Cess - _TC": [1.4, 1394.18],
-			"_Test Account CST - _TC": [27.88, 1422.06],
-			"_Test Account VAT - _TC": [156.25, 1578.31],
-			"_Test Account Customs Duty - _TC": [125, 1703.31],
-			"_Test Account Shipping Charges - _TC": [100, 1803.31],
-			"_Test Account Discount - _TC": [-180.33, 1622.98]
+			"_Test Account Excise Duty - _TC": [140, 1389.97],
+			"_Test Account Education Cess - _TC": [2.8, 1392.77],
+			"_Test Account S&H Education Cess - _TC": [1.4, 1394.17],
+			"_Test Account CST - _TC": [27.88, 1422.05],
+			"_Test Account VAT - _TC": [156.25, 1578.30],
+			"_Test Account Customs Duty - _TC": [125, 1703.30],
+			"_Test Account Shipping Charges - _TC": [100, 1803.30],
+			"_Test Account Discount - _TC": [-180.33, 1622.97]
 		}
 
 		for d in si.get("taxes"):
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
-		self.assertEquals(si.base_grand_total, 1622.98)
-		self.assertEquals(si.grand_total, 1622.98)
+		self.assertEquals(si.base_grand_total, 1622.97)
+		self.assertEquals(si.grand_total, 1622.97)
 
 	def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
 		# prepare
@@ -495,7 +497,7 @@
 				"base_rate": 2500,
 				"base_amount": 25000,
 				"net_rate": 40,
-				"net_amount": 399.98,
+				"net_amount": 399.9808009215558,
 				"base_net_rate": 2000,
 				"base_net_amount": 19999
 			},
@@ -509,7 +511,7 @@
 				"base_rate": 7500,
 				"base_amount": 37500,
 				"net_rate": 118.01,
-				"net_amount": 590.05,
+				"net_amount": 590.0531205155963,
 				"base_net_rate": 5900.5,
 				"base_net_amount": 29502.5
 			}
@@ -545,8 +547,11 @@
 			for i, k in enumerate(expected_values["keys"]):
 				self.assertEquals(d.get(k), expected_values[d.account_head][i])
 
-		self.assertEquals(si.base_grand_total, 60794.5)
-		self.assertEquals(si.grand_total, 1215.89)
+		self.assertEquals(si.base_grand_total, 60795)
+		self.assertEquals(si.grand_total, 1215.90)
+		self.assertEquals(si.rounding_adjustment, 0.01)
+		self.assertEquals(si.base_rounding_adjustment, 0.50)
+		
 
 	def test_outstanding(self):
 		w = self.make()
@@ -1313,6 +1318,40 @@
 		current_month_sales = frappe.db.get_value("Company", "_Test Company", "total_monthly_sales")
 		self.assertEqual(current_month_sales, existing_current_month_sales)
 
+	def test_rounding_adjustment(self):
+		si = create_sales_invoice(rate=24900, do_not_save=True)
+		for tax in ["Tax 1", "Tax2"]:
+			si.append("taxes", {
+				"charge_type": "On Net Total",
+				"account_head": "_Test Account Service Tax - _TC",
+				"description": tax,
+				"rate": 14,
+				"cost_center": "_Test Cost Center - _TC",
+				"included_in_print_rate": 1
+			})
+		si.save()
+
+		self.assertEqual(si.net_total, 19453.13)
+		self.assertEqual(si.grand_total, 24900)
+		self.assertEqual(si.total_taxes_and_charges, 5446.88)
+		self.assertEqual(si.rounding_adjustment, -0.01)
+
+		expected_values = dict((d[0], d) for d in [
+			[si.debit_to, 24900, 0.0],
+			["_Test Account Service Tax - _TC", 0.0, 5446.88],
+			["Sales - _TC", 0.0, 19453.13],
+			["Round Off - _TC", 0.01, 0.0]
+		])
+
+		gl_entries = frappe.db.sql("""select account, debit, credit
+			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
+			order by account asc""", si.name, as_dict=1)
+
+		for gle in gl_entries:
+			self.assertEquals(expected_values[gle.account][0], gle.account)
+			self.assertEquals(expected_values[gle.account][1], gle.debit)
+			self.assertEquals(expected_values[gle.account][2], gle.credit)
+
 def create_sales_invoice(**args):
 	si = frappe.new_doc("Sales Invoice")
 	args = frappe._dict(args)
diff --git a/erpnext/subscription/doctype/subscription/__init__.py b/erpnext/accounts/doctype/subscription/__init__.py
similarity index 100%
rename from erpnext/subscription/doctype/subscription/__init__.py
rename to erpnext/accounts/doctype/subscription/__init__.py
diff --git a/erpnext/accounts/doctype/subscription/subscription.js b/erpnext/accounts/doctype/subscription/subscription.js
new file mode 100644
index 0000000..c9b3c64
--- /dev/null
+++ b/erpnext/accounts/doctype/subscription/subscription.js
@@ -0,0 +1,77 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Subscription', {
+	setup: function(frm) {
+		if(frm.doc.__islocal) {
+			var last_route = frappe.route_history.slice(-2, -1)[0];
+			if(frappe.dynamic_link && frappe.dynamic_link.doc
+					&& frappe.dynamic_link.doc.name==last_route[2]) {
+				frm.set_value('reference_doctype', last_route[1]);
+				frm.set_value('reference_document', last_route[2]);
+			}
+		}
+
+		frm.fields_dict['reference_document'].get_query = function() {
+			return {
+				filters: {
+					"docstatus": 1
+				}
+			};
+		};
+
+		frm.fields_dict['print_format'].get_query = function() {
+			return {
+				filters: {
+					"doc_type": frm.doc.reference_doctype
+				}
+			};
+		};
+	},
+
+	refresh: function(frm) {
+		if(frm.doc.docstatus == 1) {
+			let label = __('View {0}', [frm.doc.reference_doctype]);
+			frm.add_custom_button(__(label),
+				function() {
+					frappe.route_options = {
+						"subscription": frm.doc.name,
+					};
+					frappe.set_route("List", frm.doc.reference_doctype);
+				}
+			);
+
+			if(frm.doc.status != 'Stopped') {
+				frm.add_custom_button(__("Stop"),
+					function() {
+						frm.events.stop_resume_subscription(frm, "Stopped");
+					}
+				);
+			}
+
+			if(frm.doc.status == 'Stopped') {
+				frm.add_custom_button(__("Resume"),
+					function() {
+						frm.events.stop_resume_subscription(frm, "Resumed");
+					}
+				);
+			}
+		}
+	},
+
+	stop_resume_subscription: function(frm, status) {
+		frappe.call({
+			method: "erpnext.accounts.doctype.subscription.subscription.stop_resume_subscription",
+			args: {
+				subscription: frm.doc.name,
+				status: status
+			},
+			callback: function(r) {
+				if(r.message) {
+					frm.set_value("status", r.message);
+					frm.reload_doc();
+				}
+			}
+		});
+	}
+});
\ No newline at end of file
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/accounts/doctype/subscription/subscription.json
similarity index 94%
rename from erpnext/subscription/doctype/subscription/subscription.json
rename to erpnext/accounts/doctype/subscription/subscription.json
index 6cfee1e..8577953 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/accounts/doctype/subscription/subscription.json
@@ -148,7 +148,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Disabled", 
    "length": 0, 
@@ -619,24 +619,24 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
+   "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
    "default": "Draft", 
    "fieldname": "status", 
    "fieldtype": "Select", 
-   "hidden": 1, 
+   "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
    "label": "Status", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
+   "options": "\nDraft\nStopped\nSubmitted\nCancelled\nCompleted", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -690,9 +690,9 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-09-14 12:09:38.471458", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
+ "module": "Accounts", 
  "name": "Subscription", 
  "name_case": "", 
  "owner": "Administrator", 
@@ -700,7 +700,7 @@
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
-   "cancel": 1, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
@@ -716,6 +716,46 @@
    "share": 1, 
    "submit": 1, 
    "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
   }
  ], 
  "quick_entry": 0, 
diff --git a/erpnext/subscription/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py
similarity index 82%
rename from erpnext/subscription/doctype/subscription/subscription.py
rename to erpnext/accounts/doctype/subscription/subscription.py
index be36211..c9df7d4 100644
--- a/erpnext/subscription/doctype/subscription/subscription.py
+++ b/erpnext/accounts/doctype/subscription/subscription.py
@@ -71,13 +71,16 @@
 
 		doc.db_set('subscription', self.name)
 
-	def update_status(self):
+	def update_status(self, status=None):
 		self.status = {
 			'0': 'Draft',
 			'1': 'Submitted',
 			'2': 'Cancelled'
 		}[cstr(self.docstatus or 0)]
 
+		if status and status != 'Resumed':
+			self.status = status
+
 def get_next_schedule_date(start_date, frequency, repeat_on_day):
 	mcount = month_map.get(frequency)
 	if mcount:
@@ -93,11 +96,10 @@
 		schedule_date = getdate(data.next_schedule_date)
 		while schedule_date <= getdate(today()):
 			create_documents(data, schedule_date)
-
 			schedule_date = get_next_schedule_date(schedule_date,
 				data.frequency, data.repeat_on_day)
 
-			if schedule_date:
+			if schedule_date and not frappe.db.get_value('Subscription', data.name, 'disabled'):
 				frappe.db.set_value('Subscription', data.name, 'next_schedule_date', schedule_date)
 
 def get_subscription_entries(date):
@@ -105,23 +107,29 @@
 		where docstatus = 1 and next_schedule_date <=%s
 			and reference_document is not null and reference_document != ''
 			and next_schedule_date <= ifnull(end_date, '2199-12-31')
-			and ifnull(disabled, 0) = 0""", (date), as_dict=1)
+			and ifnull(disabled, 0) = 0 and status != 'Stopped' """, (date), as_dict=1)
 
 def create_documents(data, schedule_date):
 	try:
 		doc = make_new_document(data, schedule_date)
-		if data.notify_by_email:
-			send_notification(doc, data.print_format, data.recipients)
+		if data.notify_by_email and data.recipients:
+			print_format = data.print_format or "Standard"
+			send_notification(doc, print_format, data.recipients)
 
 		frappe.db.commit()
 	except Exception:
 		frappe.db.rollback()
 		frappe.db.begin()
 		frappe.log_error(frappe.get_traceback())
+		disabled_subscription(data)
 		frappe.db.commit()
 		if data.reference_document and not frappe.flags.in_test:
 			notify_error_to_user(data)
 
+def disabled_subscription(data):
+	subscription = frappe.get_doc('Subscription', data.name)
+	subscription.db_set('disabled', 1)
+
 def notify_error_to_user(data):
 	party = ''
 	party_type = ''
@@ -134,7 +142,7 @@
 	if party_type:
 		party = frappe.db.get_value(data.reference_doctype, data.reference_document, party_type)
 
-	notify_errors(data.reference_document, data.reference_doctype, party, data.owner)
+	notify_errors(data.reference_document, data.reference_doctype, party, data.owner, data.name)
 
 def make_new_document(args, schedule_date):
 	doc = frappe.get_doc(args.reference_doctype, args.reference_document)
@@ -168,32 +176,32 @@
 
 def send_notification(new_rv, print_format='Standard', recipients=None):
 	"""Notify concerned persons about recurring document generation"""
-	recipients = recipients or new_rv.notification_email_address
-	print_format = print_format or new_rv.recurring_print_format
+	print_format = print_format
 
 	frappe.sendmail(recipients,
 		subject=  _("New {0}: #{1}").format(new_rv.doctype, new_rv.name),
 		message = _("Please find attached {0} #{1}").format(new_rv.doctype, new_rv.name),
 		attachments = [frappe.attach_print(new_rv.doctype, new_rv.name, file_name=new_rv.name, print_format=print_format)])
 
-def notify_errors(doc, doctype, party, owner):
+def notify_errors(doc, doctype, party, owner, name):
 	recipients = get_system_managers(only_name=True)
 	frappe.sendmail(recipients + [frappe.db.get_value("User", owner, "email")],
-		subject="[Urgent] Error while creating recurring %s for %s" % (doctype, doc),
+		subject=_("[Urgent] Error while creating recurring %s for %s" % (doctype, doc)),
 		message = frappe.get_template("templates/emails/recurring_document_failed.html").render({
-			"type": doctype,
+			"type": _(doctype),
 			"name": doc,
-			"party": party or ""
+			"party": party or "",
+			"subscription": name
 		}))
 
-	assign_task_to_owner(doc, doctype, "Recurring Invoice Failed", recipients)
+	assign_task_to_owner(name, "Recurring Documents Failed", recipients)
 
-def assign_task_to_owner(doc, doctype, msg, users):
+def assign_task_to_owner(name, msg, users):
 	for d in users:
 		args = {
+			'doctype'		:	'Subscription',
 			'assign_to' 	:	d,
-			'doctype'		:	doctype,
-			'name'			:	doc,
+			'name'			:	name,
 			'description'	:	msg,
 			'priority'		:	'High'
 		}
@@ -205,3 +213,16 @@
 	doc.reference_doctype = doctype
 	doc.reference_document = docname
 	return doc
+
+@frappe.whitelist()
+def stop_resume_subscription(subscription, status):
+	doc = frappe.get_doc('Subscription', subscription)
+	frappe.msgprint(_("Subscription has been {0}").format(status))
+	if status == 'Resumed':
+		doc.next_schedule_date = get_next_schedule_date(today(),
+			doc.frequency, doc.repeat_on_day)
+
+	doc.update_status(status)
+	doc.save()
+
+	return doc.status
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/subscription/subscription_list.js b/erpnext/accounts/doctype/subscription/subscription_list.js
new file mode 100644
index 0000000..71e3cce
--- /dev/null
+++ b/erpnext/accounts/doctype/subscription/subscription_list.js
@@ -0,0 +1,16 @@
+frappe.listview_settings['Subscription'] = {
+	add_fields: ["next_schedule_date"],
+	get_indicator: function(doc) {
+		if(doc.disabled) {
+			return [__("Disabled"), "red"];
+		} else if(doc.next_schedule_date >= frappe.datetime.get_today() && doc.status != 'Stopped') {
+			return [__("Active"), "green"];
+		} else if(doc.docstatus === 0) {
+			return [__("Draft"), "red", "docstatus,=,0"];
+		} else if(doc.status === 'Stopped') {
+			return [__("Stopped"), "red"];
+		} else {
+			return [__("Expired"), "darkgrey"];
+		}
+	}
+};
\ No newline at end of file
diff --git a/erpnext/subscription/doctype/subscription/test_subscription.js b/erpnext/accounts/doctype/subscription/test_subscription.js
similarity index 100%
rename from erpnext/subscription/doctype/subscription/test_subscription.js
rename to erpnext/accounts/doctype/subscription/test_subscription.js
diff --git a/erpnext/subscription/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py
similarity index 96%
rename from erpnext/subscription/doctype/subscription/test_subscription.py
rename to erpnext/accounts/doctype/subscription/test_subscription.py
index 28f8be7..b74163c 100644
--- a/erpnext/subscription/doctype/subscription/test_subscription.py
+++ b/erpnext/accounts/doctype/subscription/test_subscription.py
@@ -10,7 +10,7 @@
 from erpnext.accounts.report.financial_statements import get_months
 from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
 from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-from erpnext.subscription.doctype.subscription.subscription import make_subscription_entry
+from erpnext.accounts.doctype.subscription.subscription import make_subscription_entry
 
 class TestSubscription(unittest.TestCase):
 	def test_daily_subscription(self):
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index 7324532..2d91a3c 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -135,7 +135,8 @@
 	for key, value in args.iteritems():
 		if key=="use_for_shopping_cart":
 			conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
-		if key == 'customer_group' and value:
+		if key == 'customer_group':
+			if not value: value = _("All Customer Groups")
 			customer_group_condition = get_customer_group_condition(value)
 			conditions.append("ifnull({0}, '') in ('', {1})".format(key, customer_group_condition))
 		else:
diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
index 383b02b..5ad7970 100644
--- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
@@ -39,7 +39,7 @@
 			sales_tax_template = "_Test Sales Taxes and Charges Template", priority = 1, from_date = "2015-01-01")
 		tax_rule1.save()
 
-		self.assertEquals(get_tax_template("2015-01-01", {"customer_group" : "Commercial"}),
+		self.assertEquals(get_tax_template("2015-01-01", {"customer_group" : "Commercial", "use_for_shopping_cart":0}),
 			"_Test Sales Taxes and Charges Template")
 
 	def test_conflict_with_overlapping_dates(self):
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 45d2ef2..d370c49 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -137,14 +137,7 @@
 		make_round_off_gle(gl_map, debit_credit_diff)
 
 def make_round_off_gle(gl_map, debit_credit_diff):
-	round_off_account, round_off_cost_center = frappe.db.get_value("Company", gl_map[0].company,
-		["round_off_account", "round_off_cost_center"]) or [None, None]
-	if not round_off_account:
-		frappe.throw(_("Please mention Round Off Account in Company"))
-
-	if not round_off_cost_center:
-		frappe.throw(_("Please mention Round Off Cost Center in Company"))
-
+	round_off_account, round_off_cost_center = get_round_off_account_and_cost_center(gl_map[0].company)
 
 	round_off_gle = frappe._dict()
 	for k in ["voucher_type", "voucher_no", "company",
@@ -166,6 +159,17 @@
 
 	gl_map.append(round_off_gle)
 
+def get_round_off_account_and_cost_center(company):
+	round_off_account, round_off_cost_center = frappe.db.get_value("Company", company,
+		["round_off_account", "round_off_cost_center"]) or [None, None]
+	if not round_off_account:
+		frappe.throw(_("Please mention Round Off Account in Company"))
+
+	if not round_off_cost_center:
+		frappe.throw(_("Please mention Round Off Cost Center in Company"))
+
+	return round_off_account, round_off_cost_center
+
 def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
 		adv_adj=False, update_outstanding="Yes"):
 
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index a11f77d..be0b6f7 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -269,9 +269,7 @@
 			this.calculate_outstanding_amount();
 		}
 
-		if (this.frm.doc.customer) {
-			this.party_field.$input.val(this.frm.doc.customer);
-		}
+		this.set_customer_value_in_party_field();
 
 		if (!this.frm.doc.write_off_account) {
 			this.frm.doc.write_off_account = doc.write_off_account
@@ -282,6 +280,12 @@
 		}
 	},
 
+	set_customer_value_in_party_field: function() {
+		if (this.frm.doc.customer) {
+			this.party_field.$input.val(this.frm.doc.customer);
+		}
+	},
+
 	get_invoice_doc: function (si_docs) {
 		var me = this;
 		this.si_docs = this.get_doc_from_localstorage();
@@ -695,6 +699,7 @@
 
 	set_focus: function () {
 		if (this.default_customer || this.frm.doc.customer) {
+			this.set_customer_value_in_party_field();
 			this.serach_item.$input.focus();
 		} else {
 			this.party_field.$input.focus();
diff --git a/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json b/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json
index 051a123..5debb5c 100644
--- a/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json
+++ b/erpnext/accounts/print_format/gst_pos_invoice/gst_pos_invoice.json
@@ -1,5 +1,5 @@
 {
- "align_labels_left": 0, 
+ "align_labels_right": 0, 
  "creation": "2017-08-08 12:33:04.773099", 
  "custom_format": 1, 
  "disabled": 0, 
@@ -10,7 +10,7 @@
  "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{% if doc.company_address_display %}\n\t\t{% set company_address = doc.company_address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t{% if \"GSTIN\" not in company_address %}\n\t\t\t{{ company_address }}\n\t\t\t<b>{{ _(\"GSTIN\") }}:</b>{{ doc.company_gstin }}\n\t\t{% else %}\n\t\t\t{{ company_address.replace(\"GSTIN\", \"<br>GSTIN\") }}\n\t\t{% endif %}\n\t{% endif %}\n\t<br>\n\t<b>{{ doc.select_print_heading or _(\"Invoice\") }}</b><br>\n</p>\n<p>\n\t<b>{{ _(\"Receipt No\") }}:</b> {{ doc.name }}<br>\n\t<b>{{ _(\"Date\") }}:</b> {{ doc.get_formatted(\"posting_date\") }}<br>\n\t{% if doc.grand_total > 50000 %}\n\t\t{% set customer_address = doc.address_display.replace(\"\\n\", \" \").replace(\"<br>\", \" \") %}\n\t\t<b>{{ _(\"Customer\") }}:</b><br>\n\t\t{{ doc.customer_name }}<br>\n\t\t{{ customer_address }}\n\t{% endif %}\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"40%\">{{ _(\"Item\") }}</b></th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Qty\") }}</th>\n\t\t\t<th width=\"30%\" class=\"text-right\">{{ _(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{%- for item in doc.items -%}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t<br>{{ item.item_name }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.gst_hsn_code -%}\n\t\t\t\t\t<br><b>{{ _(\"HSN/SAC\") }}:</b> {{ item.gst_hsn_code }}\n\t\t\t\t{%- endif -%}\n\t\t\t\t{%- if item.serial_no -%}\n\t\t\t\t\t<br><b>{{ _(\"Serial No\") }}:</b> {{ item.serial_no }}\n\t\t\t\t{%- endif -%}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ item.rate }}</td>\n\t\t\t<td class=\"text-right\">{{ item.get_formatted(\"amount\") }}</td>\n\t\t</tr>\n\t\t{%- endfor -%}\n\t</tbody>\n</table>\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"net_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{%- endif -%}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ _(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n<p><b>Tax Breakup:</b></p>\n<div style=\"font-size: 8px\">\n\t{{ doc.other_charges_calculation }}\n</div>\n<p>{{ doc.terms or \"\" }}</p>\n<p class=\"text-center\">{{ _(\"Thank you, please visit again.\") }}</p>", 
  "idx": 0, 
  "line_breaks": 0, 
- "modified": "2017-08-29 15:54:19.467642", 
+ "modified": "2017-09-14 15:54:19.467642", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "GST POS Invoice", 
diff --git a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
index 4e69cad..49696d2 100644
--- a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
+++ b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
@@ -1,5 +1,5 @@
 {
- "align_labels_left": 0, 
+ "align_labels_right": 0, 
  "creation": "2016-05-05 17:16:18.564460", 
  "custom_format": 1, 
  "disabled": 0, 
@@ -10,7 +10,7 @@
  "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{  __(\"POS No : \") }} {{ offline_pos_name }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Customer\") }}:</b> {{ customer }}<br>\n</p>\n\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, null,precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p>{{ terms }}</p>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>", 
  "idx": 0, 
  "line_breaks": 0, 
- "modified": "2017-09-01 14:27:04.871233", 
+ "modified": "2017-09-14 14:36:04.740728", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Point of Sale", 
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index d81c1eb..b0c49df 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -142,10 +142,16 @@
 
 	return out
 
+
 def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy):
 	for entries in gl_entries_by_account.values():
 		for entry in entries:
 			d = accounts_by_name.get(entry.account)
+			if not d:
+				frappe.msgprint(
+					_("Could not retrieve information for {0}.".format(entry.account)), title="Error",
+					raise_exception=1
+				)
 			for period in period_list:
 				# check if posting date is within the period
 
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index e2106e2..07f6979 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -17,7 +17,6 @@
 	gross_profit_data = GrossProfitGenerator(filters)
 
 	data = []
-	source = gross_profit_data.grouped_data if filters.get("group_by") != "Invoice" else gross_profit_data.data
 
 	group_wise_columns = frappe._dict({
 		"invoice": ["parent", "customer", "customer_group", "posting_date","item_code", "item_name","item_group", "brand", "description", \
@@ -45,7 +44,7 @@
 
 	columns = get_columns(group_wise_columns, filters)
 
-	for src in source:
+	for src in gross_profit_data.grouped_data:
 		row = []
 		for col in group_wise_columns.get(scrub(filters.group_by)):
 			row.append(src.get(col))
@@ -103,6 +102,7 @@
 		self.load_stock_ledger_entries()
 		self.load_product_bundle()
 		self.load_non_stock_items()
+		self.get_returned_invoice_items()
 		self.process()
 
 	def process(self):
@@ -143,40 +143,68 @@
 				row.gross_profit_percent = 0.0
 
 			# add to grouped
-			if self.filters.group_by != "Invoice":
-				self.grouped.setdefault(row.get(scrub(self.filters.group_by)), []).append(row)
-
-			self.data.append(row)
+			self.grouped.setdefault(row.get(scrub(self.filters.group_by)), []).append(row)
 
 		if self.grouped:
 			self.get_average_rate_based_on_group_by()
-		else:
-			self.grouped_data = []
 
 	def get_average_rate_based_on_group_by(self):
 		# sum buying / selling totals for group
 		self.grouped_data = []
 		for key in self.grouped.keys():
-			for i, row in enumerate(self.grouped[key]):
-				if i==0:
-					new_row = row
-				else:
-					new_row.qty += row.qty
-					new_row.buying_amount += row.buying_amount
-					new_row.base_amount += row.base_amount
+			if self.filters.get("group_by") != "Invoice":
+				for i, row in enumerate(self.grouped[key]):
+					if i==0:
+						new_row = row
+					else:
+						new_row.qty += row.qty
+						new_row.buying_amount += row.buying_amount
+						new_row.base_amount += row.base_amount
+				new_row = self.set_average_rate(new_row)
+				self.grouped_data.append(new_row)
+			else:
+				for i, row in enumerate(self.grouped[key]):
+					if row.parent in self.returned_invoices \
+							and row.item_code in self.returned_invoices[row.parent]:
+						returned_item_rows = self.returned_invoices[row.parent][row.item_code]
+						for returned_item_row in returned_item_rows:
+							row.qty += returned_item_row.qty
+							row.base_amount += returned_item_row.base_amount
+						row.buying_amount = row.qty * row.buying_rate
+					if row.qty:
+						row = self.set_average_rate(row)
+						self.grouped_data.append(row)
 
-			new_row.gross_profit = new_row.base_amount - new_row.buying_amount
-			new_row.gross_profit_percent = ((new_row.gross_profit / new_row.base_amount) * 100.0) \
-				if new_row.base_amount else 0
-			new_row.buying_rate = (new_row.buying_amount / new_row.qty) \
-				if new_row.qty else 0
-			new_row.base_rate = (new_row.base_amount / new_row.qty) \
-				if new_row.qty else 0
+	def set_average_rate(self, new_row):
+		new_row.gross_profit = new_row.base_amount - new_row.buying_amount
+		new_row.gross_profit_percent = ((new_row.gross_profit / new_row.base_amount) * 100.0) \
+			if new_row.base_amount else 0
+		new_row.buying_rate = (new_row.buying_amount / new_row.qty) if new_row.qty else 0
+		new_row.base_rate = (new_row.base_amount / new_row.qty) if new_row.qty else 0
+		return new_row
 
-			self.grouped_data.append(new_row)
+	def get_returned_invoice_items(self):
+		returned_invoices = frappe.db.sql("""
+			select
+				si.name, si_item.item_code, si_item.qty, si_item.base_amount, si.return_against
+			from
+				`tabSales Invoice` si, `tabSales Invoice Item` si_item
+			where
+				si.name = si_item.parent
+				and si.docstatus = 1
+				and si.is_return = 1
+		""", as_dict=1)
+
+		self.returned_invoices = frappe._dict()
+		for inv in returned_invoices:
+			self.returned_invoices.setdefault(inv.return_against, frappe._dict())\
+				.setdefault(inv.item_code, []).append(inv)
 
 	def skip_row(self, row, product_bundles):
-		if self.filters.get("group_by") != "Invoice" and not row.get(scrub(self.filters.get("group_by"))):
+		if self.filters.get("group_by") != "Invoice":
+			if not row.get(scrub(self.filters.get("group_by"))):
+				return True
+		elif row.get("is_return") == 1:
 			return True
 
 	def get_buying_amount_from_product_bundle(self, row, product_bundle):
@@ -268,20 +296,26 @@
 			sales_person_cols = ""
 			sales_team_table = ""
 
-		self.si_list = frappe.db.sql("""select `tabSales Invoice Item`.parenttype, `tabSales Invoice Item`.parent,
-				`tabSales Invoice`.posting_date, `tabSales Invoice`.posting_time, `tabSales Invoice`.project, `tabSales Invoice`.update_stock,
-				`tabSales Invoice`.customer, `tabSales Invoice`.customer_group, `tabSales Invoice`.territory,
-				`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.item_name, `tabSales Invoice Item`.description,
-				`tabSales Invoice Item`.warehouse, `tabSales Invoice Item`.item_group, `tabSales Invoice Item`.brand,
-				`tabSales Invoice Item`.dn_detail, `tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty,
-				`tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount, `tabSales Invoice Item`.name as "item_row"
+		self.si_list = frappe.db.sql("""
+			select
+				`tabSales Invoice Item`.parenttype, `tabSales Invoice Item`.parent,
+				`tabSales Invoice`.posting_date, `tabSales Invoice`.posting_time,
+				`tabSales Invoice`.project, `tabSales Invoice`.update_stock,
+				`tabSales Invoice`.customer, `tabSales Invoice`.customer_group,
+				`tabSales Invoice`.territory, `tabSales Invoice Item`.item_code,
+				`tabSales Invoice Item`.item_name, `tabSales Invoice Item`.description,
+				`tabSales Invoice Item`.warehouse, `tabSales Invoice Item`.item_group,
+				`tabSales Invoice Item`.brand, `tabSales Invoice Item`.dn_detail,
+				`tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.stock_qty as qty,
+				`tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount,
+				`tabSales Invoice Item`.name as "item_row", `tabSales Invoice`.is_return
 				{sales_person_cols}
 			from
-				`tabSales Invoice`
-				inner join `tabSales Invoice Item` on `tabSales Invoice Item`.parent = `tabSales Invoice`.name
+				`tabSales Invoice` inner join `tabSales Invoice Item`
+					on `tabSales Invoice Item`.parent = `tabSales Invoice`.name
 				{sales_team_table}
 			where
-				`tabSales Invoice`.docstatus = 1 {conditions} {match_cond}
+				`tabSales Invoice`.docstatus=1 {conditions} {match_cond}
 			order by
 				`tabSales Invoice`.posting_date desc, `tabSales Invoice`.posting_time desc"""
 			.format(conditions=conditions, sales_person_cols=sales_person_cols,
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index b21027e..710099e 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -91,10 +91,10 @@
 	conditions = ""
 
 	for opts in (("company", " and company=%(company)s"),
-		("supplier", " and pi.supplier = %(supplier)s"),
-		("item_code", " and pi_item.item_code = %(item_code)s"),
-		("from_date", " and pi.posting_date>=%(from_date)s"),
-		("to_date", " and pi.posting_date<=%(to_date)s"),
+		("supplier", " and `tabPurchase Invoice`.supplier = %(supplier)s"),
+		("item_code", " and `tabPurchase Invoice Item`.item_code = %(item_code)s"),
+		("from_date", " and `tabPurchase Invoice`.posting_date>=%(from_date)s"),
+		("to_date", " and `tabPurchase Invoice`.posting_date<=%(to_date)s"),
 		("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
 			if filters.get(opts[0]):
 				conditions += opts[1]
@@ -104,20 +104,29 @@
 def get_items(filters, additional_query_columns):
 	conditions = get_conditions(filters)
 	match_conditions = frappe.build_match_conditions("Purchase Invoice")
+	
+	if match_conditions:
+		match_conditions = " and {0} ".format(match_conditions)
+	
 	if additional_query_columns:
 		additional_query_columns = ', ' + ', '.join(additional_query_columns)
 
 	return frappe.db.sql("""
 		select
-			pi_item.name, pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
-			pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name,
-			pi_item.item_group, pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt,
-			pi_item.po_detail, pi_item.expense_account, pi_item.stock_qty, pi_item.stock_uom, 
-			pi_item.base_net_rate, pi_item.base_net_amount,
-			pi.supplier_name, pi.mode_of_payment {0}
-		from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
-		where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
-		order by pi.posting_date desc, pi_item.item_code desc
+			`tabPurchase Invoice Item`.`name`, `tabPurchase Invoice Item`.`parent`,
+			`tabPurchase Invoice`.posting_date, `tabPurchase Invoice`.credit_to, `tabPurchase Invoice`.company,
+			`tabPurchase Invoice`.supplier, `tabPurchase Invoice`.remarks, `tabPurchase Invoice`.base_net_total, `tabPurchase Invoice Item`.`item_code`,
+			`tabPurchase Invoice Item`.`item_name`, `tabPurchase Invoice Item`.`item_group`,
+			`tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`,
+			`tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`,
+			`tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`,
+			`tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_rate`,
+			`tabPurchase Invoice Item`.`base_net_amount`,
+			`tabPurchase Invoice`.supplier_name, `tabPurchase Invoice`.mode_of_payment {0}
+		from `tabPurchase Invoice`, `tabPurchase Invoice Item`
+		where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and
+		`tabPurchase Invoice`.docstatus = 1 %s %s
+		order by `tabPurchase Invoice`.posting_date desc, `tabPurchase Invoice Item`.item_code desc
 	""".format(additional_query_columns) % (conditions, match_conditions), filters, as_dict=1)
 
 def get_aii_accounts():
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index eb50022..9892e03 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -93,37 +93,49 @@
 	conditions = ""
 
 	for opts in (("company", " and company=%(company)s"),
-		("customer", " and si.customer = %(customer)s"),
-		("item_code", " and si_item.item_code = %(item_code)s"),
-		("from_date", " and si.posting_date>=%(from_date)s"),
-		("to_date", " and si.posting_date<=%(to_date)s")):
+		("customer", " and `tabSales Invoice`.customer = %(customer)s"),
+		("item_code", " and `tabSales Invoice Item`.item_code = %(item_code)s"),
+		("from_date", " and `tabSales Invoice`.posting_date>=%(from_date)s"),
+		("to_date", " and `tabSales Invoice`.posting_date<=%(to_date)s")):
 			if filters.get(opts[0]):
 				conditions += opts[1]
 
 	if filters.get("mode_of_payment"):
 		conditions += """ and exists(select name from `tabSales Invoice Payment`
-			 where parent=si.name
-			 	and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
+			where parent=si.name
+				and ifnull(`tabSales Invoice Payment`.mode_of_payment, '') = %(mode_of_payment)s)"""
 
 	return conditions
 
 def get_items(filters, additional_query_columns):
+	conditions = get_conditions(filters)
+	match_conditions = frappe.build_match_conditions("Sales Invoice")
+	
+	if match_conditions:
+		match_conditions = " and {0} ".format(match_conditions)
+	
 	if additional_query_columns:
 		additional_query_columns = ', ' + ', '.join(additional_query_columns)
 
-	conditions = get_conditions(filters)
 	return frappe.db.sql("""
 		select
-			si_item.name, si_item.parent, si.posting_date, si.debit_to, si.project,
-			si.customer, si.remarks, si.territory, si.company, si.base_net_total,
-			si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
-			si_item.delivery_note, si_item.income_account, si_item.cost_center,
-			si_item.stock_qty, si_item.stock_uom, si_item.base_net_rate, si_item.base_net_amount,
-			si.customer_name, si.customer_group, si_item.so_detail, si.update_stock {0}
-		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
-		where si.name = si_item.parent and si.docstatus = 1 %s
-		order by si.posting_date desc, si_item.item_code desc
-		""".format(additional_query_columns or '') % conditions, filters, as_dict=1)
+			`tabSales Invoice Item`.name, `tabSales Invoice Item`.parent,
+			`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
+			`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
+			`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
+			`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.item_name,
+			`tabSales Invoice Item`.item_group, `tabSales Invoice Item`.sales_order,
+			`tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.income_account,
+			`tabSales Invoice Item`.cost_center, `tabSales Invoice Item`.stock_qty,
+			`tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.base_net_rate,
+			`tabSales Invoice Item`.base_net_amount, `tabSales Invoice`.customer_name,
+			`tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail,
+			`tabSales Invoice`.update_stock {0}
+		from `tabSales Invoice`, `tabSales Invoice Item`
+		where `tabSales Invoice`.name = `tabSales Invoice Item`.parent
+			and `tabSales Invoice`.docstatus = 1 %s %s
+		order by `tabSales Invoice`.posting_date desc, `tabSales Invoice Item`.item_code desc
+		""".format(additional_query_columns or '') % (conditions, match_conditions), filters, as_dict=1)
 
 def get_delivery_notes_against_sales_order(item_list):
 	so_dn_map = frappe._dict()
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 1e91ffa..2eebf54 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -2108,6 +2108,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "description": "In Words will be visible once you save the Purchase Order.", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -2233,6 +2264,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "in_words", 
    "fieldtype": "Data", 
    "hidden": 0, 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 26c8c61..56f3059 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -295,6 +295,7 @@
 			"field_map": {
 				"name": "purchase_order_item",
 				"parent": "purchase_order",
+				"bom": "bom"
 			},
 			"postprocess": update_item,
 			"condition": lambda doc: abs(doc.received_qty) < abs(doc.qty) and doc.delivered_by_supplier!=1
diff --git a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js
index f831b4f..1a9cd35 100644
--- a/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js
+++ b/erpnext/buying/doctype/request_for_quotation/tests/test_request_for_quotation_for_status.js
@@ -12,7 +12,7 @@
 		() => frappe.new_doc("Request for Quotation"),
 		() => frappe.timeout(1),
 		() => cur_frm.set_value("transaction_date", "04-04-2017"),
-		() => cur_frm.set_value("company", "_Test Company"),
+		() => cur_frm.set_value("company", "For Testing"),
 		// Add Suppliers
 		() => {
 			cur_frm.fields_dict.suppliers.grid.grid_rows[0].toggle_view();
@@ -62,7 +62,7 @@
 		},
 		() => frappe.timeout(2),
 		() => {
-			cur_frm.fields_dict.items.grid.grid_rows[0].doc.warehouse = "_Test Warehouse - _TC";
+			cur_frm.fields_dict.items.grid.grid_rows[0].doc.warehouse = "_Test Warehouse - FT";
 		},
 		() => frappe.click_button('Save'),
 		() => frappe.timeout(1),
@@ -104,7 +104,7 @@
 		() => frappe.timeout(1),
 		() => frappe.click_button('Make Supplier Quotation'),
 		() => frappe.timeout(1),
-		() => cur_frm.set_value("company", "_Test Company"),
+		() => cur_frm.set_value("company", "For Testing"),
 		() => cur_frm.fields_dict.items.grid.grid_rows[0].doc.rate = 4.99,
 		() => frappe.timeout(1),
 		() => frappe.click_button('Save'),
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index b2b9063..c715fbd 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -16,7 +16,7 @@
 
 	def onload(self):
 		"""Load address and contacts in `__onload`"""
-		load_address_and_contact(self, "supplier")
+		load_address_and_contact(self)
 		self.load_dashboard_info()
 
 	def load_dashboard_info(self):
diff --git a/erpnext/buying/doctype/supplier/test_supplier.js b/erpnext/buying/doctype/supplier/test_supplier.js
index a953a8d..99a5bc6 100644
--- a/erpnext/buying/doctype/supplier/test_supplier.js
+++ b/erpnext/buying/doctype/supplier/test_supplier.js
@@ -13,8 +13,8 @@
 				{credit_days_based_on: 'Fixed Days'},
 				{accounts: [
 					[
-						{'company': "Test Company"},
-						{'account': "Creditors - TC"}
+						{'company': "For Testing"},
+						{'account': "Creditors - FT"}
 					]]
 				}
 			]);
@@ -68,7 +68,7 @@
 			assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Name correct");
 			assert.ok(cur_frm.doc.supplier_type == 'Hardware', "Type correct");
 			assert.ok(cur_frm.doc.default_currency == 'INR', "Currency correct");
-			assert.ok(cur_frm.doc.accounts[0].account == 'Creditors - '+frappe.get_abbr('Test Company'), " Account Head abbr correct");
+			assert.ok(cur_frm.doc.accounts[0].account == 'Creditors - '+frappe.get_abbr('For Testing'), " Account Head abbr correct");
 			assert.ok($('.address-box:nth-child(3) p').text().includes('Shipping City 3'), "Address correct");
 			assert.ok($('.col-sm-6+ .col-sm-6 .h6').text().includes('Contact 3'), "Contact correct");
 		},
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index eed0c15..f9ff0a6 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -1682,6 +1682,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -1807,6 +1838,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "in_words", 
    "fieldtype": "Data", 
    "hidden": 0, 
diff --git a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
index bc07b75..b151824 100644
--- a/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
+++ b/erpnext/buying/doctype/supplier_quotation/tests/test_supplier_quotation_for_item_wise_discount.js
@@ -8,13 +8,13 @@
 		() => {
 			return frappe.tests.make('Supplier Quotation', [
 				{supplier: 'Test Supplier'},
-				{company: 'Test Company'},
+				{company: 'For Testing'},
 				{items: [
 					[
 						{"item_code": 'Test Product 4'},
 						{"qty": 5},
 						{"uom": 'Unit'},
-						{"warehouse": 'All Warehouses - TC'},
+						{"warehouse": 'All Warehouses - FT'},
 						{'discount_percentage': 10},
 					]
 				]}
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 6d16e92..7c0f540 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -33,6 +33,12 @@
 					"description": _("Point of Sale")
 				},
 				{
+					"type": "doctype",
+					"name": "Subscription",
+					"label": _("Subscription"),
+					"description": _("To make recurring documents")
+				},
+				{
 					"type": "report",
 					"name": "Accounts Receivable",
 					"doctype": "Sales Invoice",
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index 029ef74..ef1ff10 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -261,5 +261,12 @@
 			"icon": "octicon octicon-mortar-board",
 			"type": "module",
 			"label": _("Schools")
+		},
+		{
+			"module_name": "Healthcare",
+			"color": "#FF888B",
+			"icon": "octicon octicon-plus",
+			"type": "module",
+			"label": _("Healthcare")
 		}
 	]
diff --git a/erpnext/config/healthcare.py b/erpnext/config/healthcare.py
new file mode 100644
index 0000000..f4bf4f7
--- /dev/null
+++ b/erpnext/config/healthcare.py
@@ -0,0 +1,157 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+
+	return [
+		{
+			"label": _("Consultation"),
+			"icon": "icon-star",
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Patient Appointment",
+					"description": _("Patient Appointment"),
+				},
+				{
+					"type": "doctype",
+					"name": "Consultation",
+					"label": _("Consultation"),
+				},
+				{
+					"type": "doctype",
+					"name": "Vital Signs",
+					"label": _("Vital Signs"),
+					"description": _("Record Patient Vitals"),
+				},
+				{
+					"type": "page",
+					"name": "medical_record",
+					"label": _("Patient Medical Record"),
+				},
+				{
+					"type": "page",
+					"name": "appointment-analytic",
+					"label": _("Appointment Analytics"),
+				}
+			]
+		},
+		{
+			"label": _("Laboratory"),
+			"icon": "icon-list",
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Lab Test",
+					"description": _("Results"),
+				},
+				{
+					"type": "doctype",
+					"name": "Sample Collection",
+					"label": _("Sample Collection"),
+				},
+				{
+					"type": "report",
+					"name": "Lab Test Report",
+					"is_query_report": True
+				}
+			]
+		},
+		{
+			"label": _("Masters"),
+			"icon": "icon-list",
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Patient",
+					"label": _("Patient"),
+				},
+				{
+					"type": "doctype",
+					"name": "Physician",
+					"label": "Physician",
+				},
+				{
+					"type": "doctype",
+					"name": "Physician Schedule",
+					"label": _("Physician Schedule"),
+				},
+				{
+					"type": "doctype",
+					"name": "Medical Code Standard",
+					"label": _("Medical Code Standard"),
+				},
+				{
+					"type": "doctype",
+					"name": "Medical Code",
+					"label": _("Medical Code"),
+				}
+			]
+		},
+		{
+			"label": _("Setup"),
+			"icon": "icon-cog",
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Healthcare Settings",
+					"label": _("Healthcare Settings"),
+				},
+				{
+					"type": "doctype",
+					"name": "Medical Department",
+					"label": "Medical Department"
+				},
+				{
+					"type": "doctype",
+					"name": "Appointment Type",
+					"description": _("Appointment Type Master"),
+				},
+				{
+					"type": "doctype",
+					"name": "Prescription Dosage",
+					"description": _("Prescription Dosage")
+				},
+				{
+					"type": "doctype",
+					"name": "Prescription Duration",
+					"description": _("Prescription Period")
+				},
+				{
+					"type": "doctype",
+					"name": "Complaint",
+					"description": _("Complaint")
+				},
+				{
+					"type": "doctype",
+					"name": "Diagnosis",
+					"description": _("Diagnosis")
+				},
+				{
+					"type": "doctype",
+					"name": "Lab Test Sample",
+					"description": _("Test Sample Master."),
+				},
+				{
+					"type": "doctype",
+					"name": "Lab Test UOM",
+					"description": _("Lab Test UOM.")
+				},
+				{
+					"type": "doctype",
+					"name": "Antibiotic",
+					"description": _("Antibiotic.")
+				},
+				{
+					"type": "doctype",
+					"name": "Sensitivity",
+					"description": _("Sensitivity Naming.")
+				},
+				{
+					"type": "doctype",
+					"name": "Lab Test Template",
+					"description": _("Lab Test Configurations.")
+				}
+			]
+		}
+	]
diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py
index b984578..dbdcd35 100644
--- a/erpnext/config/schools.py
+++ b/erpnext/config/schools.py
@@ -156,6 +156,10 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Fee Schedule"
+				},
+				{
+					"type": "doctype",
 					"name": "Fee Structure"
 				},
 				{
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 5a0b967..9cc0616 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -16,6 +16,8 @@
 class BuyingController(StockController):
 	def __setup__(self):
 		if hasattr(self, "taxes"):
+			self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
+				 "print_taxes_with_zero_amount"))
 			self.print_templates = {
 				"taxes": "templates/print_formats/includes/taxes.html"
 			}
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 11c0790..7ada8cc 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -227,21 +227,30 @@
 				"_txt": txt.replace('%', '')
 			})
 
+
 def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters, as_dict):
 	return frappe.db.sql("""
 		select `tabDelivery Note`.name, `tabDelivery Note`.customer, `tabDelivery Note`.posting_date
 		from `tabDelivery Note`
 		where `tabDelivery Note`.`%(key)s` like %(txt)s and
-			`tabDelivery Note`.docstatus = 1 and `tabDelivery Note`.is_return = 0
+			`tabDelivery Note`.docstatus = 1
 			and status not in ("Stopped", "Closed") %(fcond)s
-			and (`tabDelivery Note`.per_billed < 100 or `tabDelivery Note`.grand_total = 0)
+			and (
+				(`tabDelivery Note`.is_return = 0 and `tabDelivery Note`.per_billed < 100)
+				or `tabDelivery Note`.grand_total = 0
+				or (
+					`tabDelivery Note`.is_return = 1
+					and return_against in (select name from `tabDelivery Note` where per_billed < 100)
+				)
+			)
 			%(mcond)s order by `tabDelivery Note`.`%(key)s` asc
 	""" % {
 		"key": searchfield,
 		"fcond": get_filters_cond(doctype, filters, []),
 		"mcond": get_match_cond(doctype),
 		"txt": "%(txt)s"
-	}, { "txt": ("%%%s%%" % txt) }, as_dict=as_dict)
+	}, {"txt": ("%%%s%%" % txt)}, as_dict=as_dict)
+
 
 def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
 	cond = ""
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 10b3607..d881f18 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -14,6 +14,8 @@
 class SellingController(StockController):
 	def __setup__(self):
 		if hasattr(self, "taxes"):
+			self.flags.print_taxes_with_zero_amount = cint(frappe.db.get_single_value("Print Settings",
+				 "print_taxes_with_zero_amount"))
 			self.print_templates = {
 				"taxes": "templates/print_formats/includes/taxes.html"
 			}
@@ -177,6 +179,9 @@
 			return
 
 		for it in self.get("items"):
+			if not it.item_code:
+				continue
+
 			last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.item_code, ["last_purchase_rate", "is_stock_item"])
 			last_purchase_rate_in_sales_uom = last_purchase_rate / (it.conversion_factor or 1)
 			if flt(it.base_rate) < flt(last_purchase_rate_in_sales_uom):
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index c627664..e85e56b 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -121,9 +121,10 @@
 				cumulated_tax_fraction += tax.tax_fraction_for_current_item
 
 			if cumulated_tax_fraction and not self.discount_amount_applied and item.qty:
-				item.net_amount = flt(item.amount / (1 + cumulated_tax_fraction), item.precision("net_amount"))
+				item.net_amount = flt(item.amount / (1 + cumulated_tax_fraction))
 				item.net_rate = flt(item.net_amount / item.qty, item.precision("net_rate"))
-				item.discount_percentage = flt(item.discount_percentage, item.precision("discount_percentage"))
+				item.discount_percentage = flt(item.discount_percentage,
+					item.precision("discount_percentage"))
 
 				self._set_in_company_currency(item, ["net_rate", "net_amount"])
 
@@ -173,6 +174,7 @@
 		self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"])
 
 	def calculate_taxes(self):
+		self.doc.rounding_adjustment = 0
 		# maintain actual tax rate based on idx
 		actual_tax_dict = dict([[tax.idx, flt(tax.tax_amount, tax.precision("tax_amount"))]
 			for tax in self.doc.get("taxes") if tax.charge_type == "Actual"])
@@ -222,7 +224,9 @@
 					# adjust Discount Amount loss in last tax iteration
 					if i == (len(self.doc.get("taxes")) - 1) and self.discount_amount_applied \
 						and self.doc.discount_amount and self.doc.apply_discount_on == "Grand Total":
-							self.adjust_discount_amount_loss(tax)
+							self.doc.rounding_adjustment = flt(self.doc.grand_total
+								- flt(self.doc.discount_amount) - tax.total,
+								self.doc.precision("rounding_adjustment"))
 
 	def get_tax_amount_if_for_valuation_or_deduction(self, tax_amount, tax):
 		# if just for valuation, do not add the tax amount in total
@@ -277,36 +281,26 @@
 		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, 
 			tax.precision("tax_amount"))
 
-	def adjust_discount_amount_loss(self, tax):
-		discount_amount_loss = self.doc.grand_total - flt(self.doc.discount_amount) - tax.total
-		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
-			discount_amount_loss, tax.precision("tax_amount"))
-		tax.total = flt(tax.total + discount_amount_loss, tax.precision("total"))
-
-		self._set_in_company_currency(tax, ["total", "tax_amount_after_discount_amount"])
-
 	def manipulate_grand_total_for_inclusive_tax(self):
 		# if fully inclusive taxes and diff
-		if self.doc.get("taxes") and all(cint(t.included_in_print_rate) for t in self.doc.get("taxes")):
+		if self.doc.get("taxes") and any([cint(t.included_in_print_rate) for t in self.doc.get("taxes")]):
 			last_tax = self.doc.get("taxes")[-1]
-			diff = self.doc.total - flt(last_tax.total, self.doc.precision("grand_total"))
-
-			if diff and abs(diff) <= (2.0 / 10**last_tax.precision("tax_amount")):
-				last_tax.tax_amount += diff
-				last_tax.tax_amount_after_discount_amount += diff
-				last_tax.total += diff
-
-				self._set_in_company_currency(last_tax,
-					["total", "tax_amount", "tax_amount_after_discount_amount"])
+			non_inclusive_tax_amount = sum([flt(d.tax_amount_after_discount_amount)
+				for d in self.doc.get("taxes") if not d.included_in_print_rate])
+			diff = self.doc.total + non_inclusive_tax_amount \
+				- flt(last_tax.total, last_tax.precision("total"))
+			if diff and abs(diff) <= (5.0 / 10**last_tax.precision("tax_amount")):
+				self.doc.rounding_adjustment = flt(flt(self.doc.rounding_adjustment) +
+					flt(diff), self.doc.precision("rounding_adjustment"))
 
 	def calculate_totals(self):
-		self.doc.grand_total = flt(self.doc.get("taxes")[-1].total
-			if self.doc.get("taxes") else self.doc.net_total)
+		self.doc.grand_total = flt(self.doc.get("taxes")[-1].total) + flt(self.doc.rounding_adjustment) \
+			if self.doc.get("taxes") else flt(self.doc.net_total)
 
-		self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total,
-			self.doc.precision("total_taxes_and_charges"))
+		self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total
+			- flt(self.doc.rounding_adjustment), self.doc.precision("total_taxes_and_charges"))
 
-		self._set_in_company_currency(self.doc, ["total_taxes_and_charges"])
+		self._set_in_company_currency(self.doc, ["total_taxes_and_charges", "rounding_adjustment"])
 
 		if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
 			self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate) \
@@ -326,13 +320,22 @@
 				if (self.doc.taxes_and_charges_added or self.doc.taxes_and_charges_deducted) \
 				else self.doc.base_net_total
 
-			self._set_in_company_currency(self.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"])
+			self._set_in_company_currency(self.doc,
+				["taxes_and_charges_added", "taxes_and_charges_deducted"])
 
 		self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"])
 
+		self.set_rounded_total()
+
+	def set_rounded_total(self):
+		if frappe.db.get_single_value("Global Defaults", "disable_rounded_total"):
+			self.doc.rounded_total = self.doc.base_rounded_total = 0
+			return
+
 		if self.doc.meta.get_field("rounded_total"):
 			self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
 				self.doc.currency, self.doc.precision("rounded_total"))
+
 		if self.doc.meta.get_field("base_rounded_total"):
 			company_currency = erpnext.get_company_currency(self.doc.company)
 
@@ -525,7 +528,7 @@
 	for tax in doc.taxes:
 		if getattr(tax, "category", None) and tax.category=="Valuation":
 			continue
-		if tax.description not in tax_accounts:
+		if tax.description not in tax_accounts and tax.tax_amount_after_discount_amount:
 			tax_accounts.append(tax.description)
 
 	headers = get_itemised_tax_breakup_header(doc.doctype + " Item", tax_accounts)
@@ -565,26 +568,21 @@
 		if getattr(tax, "category", None) and tax.category=="Valuation":
 			continue
 
-		tax_amount_precision = tax.precision("tax_amount")
-		tax_rate_precision = tax.precision("rate")
-		
 		item_tax_map = json.loads(tax.item_wise_tax_detail) if tax.item_wise_tax_detail else {}
-		
-		for item_code, tax_data in item_tax_map.items():
-			itemised_tax.setdefault(item_code, frappe._dict())
+		if item_tax_map:
+			for item_code, tax_data in item_tax_map.items():
+				itemised_tax.setdefault(item_code, frappe._dict())
 			
-			if isinstance(tax_data, list):
-				precision = tax_amount_precision if tax.charge_type == "Actual" else tax_rate_precision
-				
-				itemised_tax[item_code][tax.description] = frappe._dict(dict(
-					tax_rate=flt(tax_data[0]),
-					tax_amount=flt(tax_data[1])
-				))
-			else:
-				itemised_tax[item_code][tax.description] = frappe._dict(dict(
-					tax_rate=flt(tax_data),
-					tax_amount=0.0
-				))
+				if isinstance(tax_data, list):
+					itemised_tax[item_code][tax.description] = frappe._dict(dict(
+						tax_rate=flt(tax_data[0]),
+						tax_amount=flt(tax_data[1])
+					))
+				else:
+					itemised_tax[item_code][tax.description] = frappe._dict(dict(
+						tax_rate=flt(tax_data),
+						tax_amount=0.0
+					))
 
 	return itemised_tax
 
diff --git a/erpnext/crm/doctype/item/test_item.js b/erpnext/crm/doctype/item/test_item.js
index 58cf549..c9b14ca 100644
--- a/erpnext/crm/doctype/item/test_item.js
+++ b/erpnext/crm/doctype/item/test_item.js
@@ -19,7 +19,7 @@
 				{is_stock_item: is_stock_item},
 				{standard_rate: keyboard_cost},
 				{opening_stock: no_of_items_to_stock},
-				{default_warehouse: "Stores - RB"}
+				{default_warehouse: "Stores - FT"}
 			]
 		),
 		() => {
@@ -45,7 +45,7 @@
 				{is_stock_item: is_stock_item},
 				{standard_rate: screen_cost},
 				{opening_stock: no_of_items_to_stock},
-				{default_warehouse: "Stores - RB"}
+				{default_warehouse: "Stores - FT"}
 			]
 		),
 
@@ -57,7 +57,7 @@
 				{is_stock_item: is_stock_item},
 				{standard_rate: CPU_cost},
 				{opening_stock: no_of_items_to_stock},
-				{default_warehouse: "Stores - RB"}
+				{default_warehouse: "Stores - FT"}
 			]
 		),
 
@@ -66,7 +66,7 @@
 			"Item", [
 				{item_code: "Laptop"},
 				{item_group: "Products"},
-				{default_warehouse: "Stores - RB"}
+				{default_warehouse: "Stores - FT"}
 			]
 		),
 		() => frappe.tests.make(
@@ -85,7 +85,7 @@
 				{is_stock_item: is_stock_item},
 				{standard_rate: scrap_cost},
 				{opening_stock: no_of_items_to_stock},
-				{default_warehouse: "Stores - RB"}
+				{default_warehouse: "Stores - FT"}
 			]
 		),
 		() => frappe.tests.make(
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index a05bacd..eb6e876 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -20,7 +20,7 @@
 	def onload(self):
 		customer = frappe.db.get_value("Customer", {"lead_name": self.name})
 		self.get("__onload").is_customer = customer
-		load_address_and_contact(self, "lead")
+		load_address_and_contact(self)
 
 	def validate(self):
 		self._prev = frappe._dict({
diff --git a/erpnext/demo/data/drug_list.json b/erpnext/demo/data/drug_list.json
new file mode 100644
index 0000000..51b029c
--- /dev/null
+++ b/erpnext/demo/data/drug_list.json
@@ -0,0 +1,5420 @@
+[
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Atocopherol",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Atocopherol",
+  "item_group": "Drug",
+  "item_name": "Atocopherol",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.577151",
+  "name": "Atocopherol",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Abacavir",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Abacavir",
+  "item_group": "Drug",
+  "item_name": "Abacavir",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.678257",
+  "name": "Abacavir",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Abciximab",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Abciximab",
+  "item_group": "Drug",
+  "item_name": "Abciximab",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.695413",
+  "name": "Abciximab",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Acacia",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Acacia",
+  "item_group": "Drug",
+  "item_name": "Acacia",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.797774",
+  "name": "Acacia",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Acamprosate",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Acamprosate",
+  "item_group": "Drug",
+  "item_name": "Acamprosate",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.826952",
+  "name": "Acamprosate",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Acarbose",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Acarbose",
+  "item_group": "Drug",
+  "item_name": "Acarbose",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.843890",
+  "name": "Acarbose",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Acebrofylline",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Acebrofylline",
+  "item_group": "Drug",
+  "item_name": "Acebrofylline",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.969984",
+  "name": "Acebrofylline",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Acebrofylline (SR)",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Acebrofylline (SR)",
+  "item_group": "Drug",
+  "item_name": "Acebrofylline (SR)",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:16.987354",
+  "name": "Acebrofylline (SR)",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Aceclofenac",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Aceclofenac",
+  "item_group": "Drug",
+  "item_name": "Aceclofenac",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.004369",
+  "name": "Aceclofenac",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Ash",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Ash",
+  "item_group": "Drug",
+  "item_name": "Ash",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.021192",
+  "name": "Ash",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Asparaginase",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Asparaginase",
+  "item_group": "Drug",
+  "item_name": "Asparaginase",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.038058",
+  "name": "Asparaginase",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Aspartame",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Aspartame",
+  "item_group": "Drug",
+  "item_name": "Aspartame",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.054463",
+  "name": "Aspartame",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Aspartic Acid",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Aspartic Acid",
+  "item_group": "Drug",
+  "item_name": "Aspartic Acid",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.071001",
+  "name": "Aspartic Acid",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Bleomycin",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Bleomycin",
+  "item_group": "Drug",
+  "item_name": "Bleomycin",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.087170",
+  "name": "Bleomycin",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Bleomycin Sulphate",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Bleomycin Sulphate",
+  "item_group": "Drug",
+  "item_name": "Bleomycin Sulphate",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.103691",
+  "name": "Bleomycin Sulphate",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Blue cap contains",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Blue cap contains",
+  "item_group": "Drug",
+  "item_name": "Blue cap contains",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.120040",
+  "name": "Blue cap contains",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Boran",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Boran",
+  "item_group": "Drug",
+  "item_name": "Boran",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.135964",
+  "name": "Boran",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Borax",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Borax",
+  "item_group": "Drug",
+  "item_name": "Borax",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.152575",
+  "name": "Borax",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorbutanol",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorbutanol",
+  "item_group": "Drug",
+  "item_name": "Chlorbutanol",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.168998",
+  "name": "Chlorbutanol",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorbutol",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorbutol",
+  "item_group": "Drug",
+  "item_name": "Chlorbutol",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.185316",
+  "name": "Chlorbutol",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlordiazepoxide",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlordiazepoxide",
+  "item_group": "Drug",
+  "item_name": "Chlordiazepoxide",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.208361",
+  "name": "Chlordiazepoxide",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlordiazepoxide and Clidinium Bromide",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlordiazepoxide and Clidinium Bromide",
+  "item_group": "Drug",
+  "item_name": "Chlordiazepoxide and Clidinium Bromide",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.224341",
+  "name": "Chlordiazepoxide and Clidinium Bromide",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorhexidine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorhexidine",
+  "item_group": "Drug",
+  "item_name": "Chlorhexidine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.240634",
+  "name": "Chlorhexidine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorhexidine 40%",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorhexidine 40%",
+  "item_group": "Drug",
+  "item_name": "Chlorhexidine 40%",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.256922",
+  "name": "Chlorhexidine 40%",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorhexidine Acetate",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorhexidine Acetate",
+  "item_group": "Drug",
+  "item_name": "Chlorhexidine Acetate",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.274789",
+  "name": "Chlorhexidine Acetate",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorhexidine Gluconate",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorhexidine Gluconate",
+  "item_group": "Drug",
+  "item_name": "Chlorhexidine Gluconate",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.295371",
+  "name": "Chlorhexidine Gluconate",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorhexidine HCL",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorhexidine HCL",
+  "item_group": "Drug",
+  "item_name": "Chlorhexidine HCL",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.312916",
+  "name": "Chlorhexidine HCL",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chlorhexidine Hydrochloride",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chlorhexidine Hydrochloride",
+  "item_group": "Drug",
+  "item_name": "Chlorhexidine Hydrochloride",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.329570",
+  "name": "Chlorhexidine Hydrochloride",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Chloride",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Chloride",
+  "item_group": "Drug",
+  "item_name": "Chloride",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.346088",
+  "name": "Chloride",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Fosfomycin Tromethamine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Fosfomycin Tromethamine",
+  "item_group": "Drug",
+  "item_name": "Fosfomycin Tromethamine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.362777",
+  "name": "Fosfomycin Tromethamine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Fosinopril",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Fosinopril",
+  "item_group": "Drug",
+  "item_name": "Fosinopril",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.379465",
+  "name": "Fosinopril",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Iodochlorhydroxyquinoline",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Iodochlorhydroxyquinoline",
+  "item_group": "Drug",
+  "item_name": "Iodochlorhydroxyquinoline",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.396068",
+  "name": "Iodochlorhydroxyquinoline",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Iodochlorohydroxyquinoline",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Iodochlorohydroxyquinoline",
+  "item_group": "Drug",
+  "item_name": "Iodochlorohydroxyquinoline",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.412734",
+  "name": "Iodochlorohydroxyquinoline",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Ipratropium",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Ipratropium",
+  "item_group": "Drug",
+  "item_name": "Ipratropium",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.429333",
+  "name": "Ipratropium",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Mebeverine hydrochloride",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Mebeverine hydrochloride",
+  "item_group": "Drug",
+  "item_name": "Mebeverine hydrochloride",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.445814",
+  "name": "Mebeverine hydrochloride",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Mecetronium ethylsulphate",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Mecetronium ethylsulphate",
+  "item_group": "Drug",
+  "item_name": "Mecetronium ethylsulphate",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.461696",
+  "name": "Mecetronium ethylsulphate",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Meclizine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Meclizine",
+  "item_group": "Drug",
+  "item_name": "Meclizine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.478020",
+  "name": "Meclizine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Oxaprozin",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Oxaprozin",
+  "item_group": "Drug",
+  "item_name": "Oxaprozin",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.496221",
+  "name": "Oxaprozin",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Oxazepam",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Oxazepam",
+  "item_group": "Drug",
+  "item_name": "Oxazepam",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.511933",
+  "name": "Oxazepam",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Oxcarbazepine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Oxcarbazepine",
+  "item_group": "Drug",
+  "item_name": "Oxcarbazepine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.528472",
+  "name": "Oxcarbazepine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Oxetacaine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Oxetacaine",
+  "item_group": "Drug",
+  "item_name": "Oxetacaine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.544177",
+  "name": "Oxetacaine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Oxethazaine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Oxethazaine",
+  "item_group": "Drug",
+  "item_name": "Oxethazaine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.560193",
+  "name": "Oxethazaine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Suxamethonium Chloride",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Suxamethonium Chloride",
+  "item_group": "Drug",
+  "item_name": "Suxamethonium Chloride",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.576447",
+  "name": "Suxamethonium Chloride",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Tacrolimus",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Tacrolimus",
+  "item_group": "Drug",
+  "item_name": "Tacrolimus",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.593481",
+  "name": "Tacrolimus",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Ubiquinol",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Ubiquinol",
+  "item_group": "Drug",
+  "item_name": "Ubiquinol",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.609930",
+  "name": "Ubiquinol",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin B12",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin B12",
+  "item_group": "Drug",
+  "item_name": "Vitamin B12",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.626225",
+  "name": "Vitamin B12",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin B1Hydrochloride",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin B1Hydrochloride",
+  "item_group": "Drug",
+  "item_name": "Vitamin B1Hydrochloride",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.642423",
+  "name": "Vitamin B1Hydrochloride",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin B1Monohydrate",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin B1Monohydrate",
+  "item_group": "Drug",
+  "item_name": "Vitamin B1Monohydrate",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.658946",
+  "name": "Vitamin B1Monohydrate",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin B2",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin B2",
+  "item_group": "Drug",
+  "item_name": "Vitamin B2",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.675234",
+  "name": "Vitamin B2",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin B3",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin B3",
+  "item_group": "Drug",
+  "item_name": "Vitamin B3",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.691598",
+  "name": "Vitamin B3",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin D4",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin D4",
+  "item_group": "Drug",
+  "item_name": "Vitamin D4",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.707840",
+  "name": "Vitamin D4",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Vitamin E",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Vitamin E",
+  "item_group": "Drug",
+  "item_name": "Vitamin E",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.723859",
+  "name": "Vitamin E",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Wheat Germ Oil",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Wheat Germ Oil",
+  "item_group": "Drug",
+  "item_name": "Wheat Germ Oil",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.739829",
+  "name": "Wheat Germ Oil",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Wheatgrass extr",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Wheatgrass extr",
+  "item_group": "Drug",
+  "item_name": "Wheatgrass extr",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.757695",
+  "name": "Wheatgrass extr",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Whey Protein",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Whey Protein",
+  "item_group": "Drug",
+  "item_name": "Whey Protein",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.774098",
+  "name": "Whey Protein",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Xylometazoline",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Xylometazoline",
+  "item_group": "Drug",
+  "item_name": "Xylometazoline",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.790224",
+  "name": "Xylometazoline",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Xylometazoline Hydrochloride",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Xylometazoline Hydrochloride",
+  "item_group": "Drug",
+  "item_name": "Xylometazoline Hydrochloride",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.806359",
+  "name": "Xylometazoline Hydrochloride",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Yeast",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Yeast",
+  "item_group": "Drug",
+  "item_name": "Yeast",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.823305",
+  "name": "Yeast",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Yellow Fever Vaccine",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Yellow Fever Vaccine",
+  "item_group": "Drug",
+  "item_name": "Yellow Fever Vaccine",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.840250",
+  "name": "Yellow Fever Vaccine",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Zafirlukast",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Zafirlukast",
+  "item_group": "Drug",
+  "item_name": "Zafirlukast",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.856856",
+  "name": "Zafirlukast",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Zaleplon",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Zaleplon",
+  "item_group": "Drug",
+  "item_name": "Zaleplon",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.873287",
+  "name": "Zaleplon",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Zaltoprofen",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Zaltoprofen",
+  "item_group": "Drug",
+  "item_name": "Zaltoprofen",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.889263",
+  "name": "Zaltoprofen",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ },
+ {
+  "asset_category": null,
+  "attributes": [],
+  "barcode": null,
+  "brand": null,
+  "buying_cost_center": null,
+  "country_of_origin": null,
+  "create_new_batch": 0,
+  "customer_code": "",
+  "customer_items": [],
+  "customs_tariff_number": null,
+  "default_bom": null,
+  "default_material_request_type": null,
+  "default_supplier": null,
+  "default_warehouse": null,
+  "delivered_by_supplier": 0,
+  "description": "Zanamivir",
+  "disabled": 0,
+  "docstatus": 0,
+  "doctype": "Item",
+  "end_of_life": null,
+  "expense_account": null,
+  "gst_hsn_code": null,
+  "has_batch_no": 0,
+  "has_serial_no": 0,
+  "has_variants": 0,
+  "image": null,
+  "income_account": null,
+  "inspection_required_before_delivery": 0,
+  "inspection_required_before_purchase": 0,
+  "is_fixed_asset": 0,
+  "is_purchase_item": 1,
+  "is_sales_item": 1,
+  "is_stock_item": 1,
+  "is_sub_contracted_item": 0,
+  "item_code": "Zanamivir",
+  "item_group": "Drug",
+  "item_name": "Zanamivir",
+  "last_purchase_rate": 0.0,
+  "lead_time_days": 0,
+  "manufacturer": null,
+  "manufacturer_part_no": null,
+  "max_discount": 0.0,
+  "min_order_qty": 0.0,
+  "modified": "2017-07-06 12:53:17.905022",
+  "name": "Zanamivir",
+  "naming_series": null,
+  "net_weight": 0.0,
+  "opening_stock": 0.0,
+  "publish_in_hub": 1,
+  "quality_parameters": [],
+  "reorder_levels": [],
+  "route": null,
+  "safety_stock": 0.0,
+  "selling_cost_center": null,
+  "serial_no_series": null,
+  "show_in_website": 0,
+  "show_variant_in_website": 0,
+  "slideshow": null,
+  "standard_rate": 0.0,
+  "stock_uom": "Nos",
+  "supplier_items": [],
+  "synced_with_hub": 0,
+  "taxes": [],
+  "thumbnail": null,
+  "tolerance": 0.0,
+  "total_projected_qty": 0.0,
+  "uoms": [
+   {
+    "conversion_factor": 1.0,
+    "uom": "Nos"
+   }
+  ],
+  "valuation_method": null,
+  "valuation_rate": 0.0,
+  "variant_based_on": null,
+  "variant_of": null,
+  "warranty_period": null,
+  "web_long_description": null,
+  "website_image": null,
+  "website_item_groups": [],
+  "website_specifications": [],
+  "website_warehouse": null,
+  "weight_uom": null,
+  "weightage": 0
+ }
+]
diff --git a/erpnext/demo/data/item.json b/erpnext/demo/data/item.json
index e208522..fe12ce8 100644
--- a/erpnext/demo/data/item.json
+++ b/erpnext/demo/data/item.json
@@ -167,6 +167,7 @@
   "item_group": "Products",
   "item_name": "Wind Turbine-S",
   "variant_of": "Wind Turbine",
+  "valuation_rate": 300,
   "attributes":[
       {
        "attribute": "Size",
@@ -183,6 +184,7 @@
   "item_group": "Products",
   "item_name": "Wind Turbine-M",
   "variant_of": "Wind Turbine",
+  "valuation_rate": 300,
   "attributes":[
       {
        "attribute": "Size",
@@ -199,6 +201,7 @@
   "item_group": "Products",
   "item_name": "Wind Turbine-L",
   "variant_of": "Wind Turbine",
+  "valuation_rate": 300,
   "attributes":[
       {
        "attribute": "Size",
diff --git a/erpnext/demo/data/patient.json b/erpnext/demo/data/patient.json
new file mode 100644
index 0000000..6d95a20
--- /dev/null
+++ b/erpnext/demo/data/patient.json
@@ -0,0 +1,27 @@
+[
+  {
+  "patient_name": "lila",
+  "gender": "Female"
+  },
+  {
+  "patient_name": "charline",
+  "gender": "Female"
+  },
+  {
+  "patient_name": "soren",
+  "last_name": "le gall",
+  "gender": "Male"
+  },
+  {
+  "patient_name": "fanny",
+  "gender": "Female"
+  },
+  {
+  "patient_name": "julie",
+  "gender": "Female"
+  },
+  {
+  "patient_name": "louka",
+  "gender": "Male"
+  }
+]
diff --git a/erpnext/demo/data/physician.json b/erpnext/demo/data/physician.json
new file mode 100644
index 0000000..3afea99
--- /dev/null
+++ b/erpnext/demo/data/physician.json
@@ -0,0 +1,17 @@
+[
+	{
+		"doctype": "Physician",
+		"first_name": "Eddie Jessup",
+		"department": "Pathology"
+	},
+	{
+		"doctype": "Physician",
+		"first_name": "Deepshi Garg",
+		"department": "ENT"
+	},
+	{
+		"doctype": "Physician",
+		"first_name": "Amit Jain",
+		"department": "Microbiology"
+	}
+]
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index 9fde264..35256b5 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -4,7 +4,7 @@
 import erpnext
 import frappe.utils
 from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset, schools
-from erpnext.demo.setup import education, manufacture, setup_data
+from erpnext.demo.setup import education, manufacture, setup_data, healthcare
 """
 Make a demo
 
@@ -30,6 +30,8 @@
 		manufacture.setup_data()
 	elif domain== 'Education':
 		education.setup_data()
+	elif domain== 'Healthcare':
+		healthcare.setup_data()
 
 	site = frappe.local.site
 	frappe.destroy()
diff --git a/erpnext/demo/domains.py b/erpnext/demo/domains.py
index 5743e27..456eb5d 100644
--- a/erpnext/demo/domains.py
+++ b/erpnext/demo/domains.py
@@ -15,5 +15,8 @@
 	},
 	'Education': {
 		'company_name': 'Whitmore College'
+	},
+	'Healthcare': {
+		'company_name': 'ABC Hospital Ltd.'
 	}
 }
\ No newline at end of file
diff --git a/erpnext/demo/setup/healthcare.py b/erpnext/demo/setup/healthcare.py
new file mode 100644
index 0000000..d645e30
--- /dev/null
+++ b/erpnext/demo/setup/healthcare.py
@@ -0,0 +1,166 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+import frappe, json
+from frappe.utils.make_random import get_random
+import datetime
+from erpnext.demo.setup.setup_data import import_json
+from frappe.utils import getdate
+from erpnext.healthcare.doctype.lab_test.lab_test import create_test_from_template
+
+def setup_data():
+	frappe.flags.mute_emails = True
+	make_masters()
+	make_patient()
+	make_lab_test()
+	make_consulation()
+	make_appointment()
+	consulation_on_appointment()
+	lab_test_on_consultation()
+	frappe.db.commit()
+	frappe.clear_cache()
+
+def make_masters():
+	import_json("Physician")
+	import_drug()
+	frappe.db.commit()
+
+def make_patient():
+	file_path = get_json_path("Patient")
+	with open(file_path, "r") as open_file:
+		patient_data = json.loads(open_file.read())
+		count = 1
+
+		for d in enumerate(patient_data):
+			patient = frappe.new_doc("Patient")
+			patient.patient_name = d[1]['patient_name'].title()
+			patient.sex = d[1]['gender']
+			patient.blood_group = "A Positive"
+			patient.date_of_birth = datetime.datetime(1990, 3, 25)
+			patient.email_id = d[1]['patient_name'] + "_" + patient.date_of_birth.strftime('%m/%d/%Y') + "@example.com"
+			if count <5:
+				patient.insert()
+				frappe.db.commit()
+			count+=1
+
+def make_appointment():
+	i = 1
+	while i <= 4:
+		physician = get_random("Physician")
+		department = frappe.get_value("Physician", physician, "department")
+		patient = get_random("Patient")
+		patient_sex = frappe.get_value("Patient", patient, "sex")
+		appointment = frappe.new_doc("Patient Appointment")
+		startDate = datetime.datetime.now()
+		for x in random_date(startDate,0):
+			appointment_datetime = x
+		appointment.appointment_datetime = appointment_datetime
+		appointment.appointment_time = appointment_datetime
+		appointment.appointment_date = appointment_datetime
+		appointment.patient = patient
+		appointment.patient_sex = patient_sex
+		appointment.physician = physician
+		appointment.department = department
+		appointment.save(ignore_permissions = True)
+		i += 1
+
+def make_consulation():
+	for i in xrange(3):
+		physician = get_random("Physician")
+		department = frappe.get_value("Physician", physician, "department")
+		patient = get_random("Patient")
+		patient_sex = frappe.get_value("Patient", patient, "sex")
+		consultation = set_consultation(patient, patient_sex, physician, department, getdate(), i)
+		consultation.save(ignore_permissions=True)
+
+def consulation_on_appointment():
+	for i in xrange(3):
+		appointment = get_random("Patient Appointment")
+		appointment = frappe.get_doc("Patient Appointment",appointment)
+		consultation = set_consultation(appointment.patient, appointment.patient_sex, appointment.physician, appointment.department, appointment.appointment_date, i)
+		consultation.appointment = appointment.name
+		consultation.save(ignore_permissions=True)
+
+def set_consultation(patient, patient_sex, physician, department, consultation_date, i):
+	consultation = frappe.new_doc("Consultation")
+	consultation.patient = patient
+	consultation.patient_sex = patient_sex
+	consultation.physician = physician
+	consultation.visit_department = department
+	consultation.consultation_date = consultation_date
+	if i > 2 and patient_sex=='Female':
+		consultation.symptoms = "Having chest pains for the last week."
+		consultation.diagnosis = """This patient's description of dull, aching,
+		exertion related substernal chest pain is suggestive of ischemic
+		cardiac origin. Her findings of a FH of early ASCVD, hypertension,
+		and early surgical menopause are pertinent risk factors for development
+		of coronary artery disease. """
+	else:
+		consultation = append_drug_rx(consultation)
+		consultation = append_test_rx(consultation)
+	return consultation
+
+def make_lab_test():
+	physician = get_random("Physician")
+	patient = get_random("Patient")
+	patient_sex = frappe.get_value("Patient", patient, "sex")
+	template = get_random("Lab Test Template")
+	set_lab_test(patient, patient_sex, physician, template)
+
+def lab_test_on_consultation():
+	i = 1
+	while i <= 2:
+		test_rx = get_random("Lab Prescription", filters={'test_created': 0})
+		test_rx = frappe.get_doc("Lab Prescription", test_rx)
+		consultation = frappe.get_doc("Consultation", test_rx.parent)
+		set_lab_test(consultation.patient, consultation.patient_sex, consultation.physician, test_rx.test_code, test_rx.name)
+		i += 1
+
+def set_lab_test(patient, patient_sex, physician, template, rx=None):
+	lab_test = frappe.new_doc("Lab Test")
+	lab_test.physician = physician
+	lab_test.patient = patient
+	lab_test.patient_sex = patient_sex
+	lab_test.template = template
+	lab_test.prescription = rx
+	create_test_from_template(lab_test)
+
+def append_test_rx(consultation):
+	i = 1
+	while i <= 2:
+		test_rx = consultation.append("test_prescription")
+		test_rx.test_code = get_random("Lab Test Template")
+		i += 1
+	return consultation
+
+def append_drug_rx(consultation):
+	i = 1
+	while i <= 3:
+		drug = get_random("Item", filters={"item_group":"Drug"})
+		drug = frappe.get_doc("Item", drug)
+		drug_rx = consultation.append("drug_prescription")
+		drug_rx.drug_code = drug.item_code
+		drug_rx.drug_name = drug.item_name
+		drug_rx.dosage = get_random("Prescription Dosage")
+		drug_rx.period = get_random("Prescription Duration")
+		i += 1
+	return consultation
+
+def random_date(start,l):
+   current = start
+   while l >= 0:
+      curr = current + datetime.timedelta(minutes=60)
+      yield curr
+      l-=1
+
+def import_drug():
+	frappe.flags.in_import = True
+	data = json.loads(open(frappe.get_app_path('erpnext', 'demo', 'data', 'drug_list.json')).read())
+	for d in data:
+		doc = frappe.new_doc("Item")
+		doc.update(d)
+		doc.insert()
+	frappe.flags.in_import = False
+
+def get_json_path(doctype):
+		return frappe.get_app_path('erpnext', 'demo', 'data', frappe.scrub(doctype) + '.json')
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index cec425c..c4df777 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -184,7 +184,8 @@
 	user.add_roles('HR User', 'HR Manager', 'Accounts User', 'Accounts Manager',
 		'Stock User', 'Stock Manager', 'Sales User', 'Sales Manager', 'Purchase User',
 		'Purchase Manager', 'Projects User', 'Manufacturing User', 'Manufacturing Manager',
-		'Support Team', 'Academics User')
+		'Support Team', 'Academics User', 'Physician', 'Healthcare Administrator', 'Laboratory User',
+		'Nursing User', 'Patient')
 
 	if not frappe.db.get_global('demo_hr_user'):
 		user = frappe.get_doc('User', 'CharmaineGaudreau@example.com')
@@ -387,5 +388,3 @@
 	frappe.db.commit()
 
 	frappe.flags.in_import = False
-
-
diff --git a/erpnext/docs/assets/img/subscription/subscription.gif b/erpnext/docs/assets/img/accounts/subscription.gif
similarity index 100%
rename from erpnext/docs/assets/img/subscription/subscription.gif
rename to erpnext/docs/assets/img/accounts/subscription.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/subscription/subscription.png b/erpnext/docs/assets/img/accounts/subscription.png
similarity index 100%
rename from erpnext/docs/assets/img/subscription/subscription.png
rename to erpnext/docs/assets/img/accounts/subscription.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._.DS_Store b/erpnext/docs/assets/img/healthcare/._.DS_Store
new file mode 100755
index 0000000..77c0a11
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._.DS_Store
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._appointment_1.png b/erpnext/docs/assets/img/healthcare/._appointment_1.png
new file mode 100755
index 0000000..9185da5
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._appointment_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._appointment_2.png b/erpnext/docs/assets/img/healthcare/._appointment_2.png
new file mode 100755
index 0000000..901903a
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._appointment_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._appointment_3.png b/erpnext/docs/assets/img/healthcare/._appointment_3.png
new file mode 100755
index 0000000..acac326
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._appointment_3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._consultation_1.png b/erpnext/docs/assets/img/healthcare/._consultation_1.png
new file mode 100755
index 0000000..26693f4
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._consultation_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._consultation_2.png b/erpnext/docs/assets/img/healthcare/._consultation_2.png
new file mode 100755
index 0000000..ddb28b0
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._consultation_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._consultation_3.png b/erpnext/docs/assets/img/healthcare/._consultation_3.png
new file mode 100755
index 0000000..75615ee
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._consultation_3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._consultation_4.png b/erpnext/docs/assets/img/healthcare/._consultation_4.png
new file mode 100755
index 0000000..a18b518
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._consultation_4.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._home.png b/erpnext/docs/assets/img/healthcare/._home.png
new file mode 100755
index 0000000..38c9eaf
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._home.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._lab_test_1.png b/erpnext/docs/assets/img/healthcare/._lab_test_1.png
new file mode 100755
index 0000000..36be754
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._lab_test_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._lab_test_2.png b/erpnext/docs/assets/img/healthcare/._lab_test_2.png
new file mode 100755
index 0000000..684798b
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._lab_test_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._medical_code_1.png b/erpnext/docs/assets/img/healthcare/._medical_code_1.png
new file mode 100755
index 0000000..a27e933
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._medical_code_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._medical_record_1.png b/erpnext/docs/assets/img/healthcare/._medical_record_1.png
new file mode 100755
index 0000000..df79c91
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._medical_record_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._medical_record_2.png b/erpnext/docs/assets/img/healthcare/._medical_record_2.png
new file mode 100755
index 0000000..8991667
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._medical_record_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._module.png b/erpnext/docs/assets/img/healthcare/._module.png
new file mode 100755
index 0000000..f8a4a0f
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._module.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._patient_1.png b/erpnext/docs/assets/img/healthcare/._patient_1.png
new file mode 100755
index 0000000..589703e
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._patient_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._patient_2.png b/erpnext/docs/assets/img/healthcare/._patient_2.png
new file mode 100755
index 0000000..0ac360a
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._patient_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._patient_3.png b/erpnext/docs/assets/img/healthcare/._patient_3.png
new file mode 100755
index 0000000..d8e0ed2
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._patient_3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._physician_1.png b/erpnext/docs/assets/img/healthcare/._physician_1.png
new file mode 100755
index 0000000..bf7889b
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._physician_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._physician_2.png b/erpnext/docs/assets/img/healthcare/._physician_2.png
new file mode 100755
index 0000000..a726f9a
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._physician_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._physician_schedule_1.png b/erpnext/docs/assets/img/healthcare/._physician_schedule_1.png
new file mode 100755
index 0000000..6dba9d5
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._physician_schedule_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._physician_schedule_2.png b/erpnext/docs/assets/img/healthcare/._physician_schedule_2.png
new file mode 100755
index 0000000..02eec95
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._physician_schedule_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._sample_collection_1.png b/erpnext/docs/assets/img/healthcare/._sample_collection_1.png
new file mode 100755
index 0000000..c72cbf7
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._sample_collection_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._vitals_1.png b/erpnext/docs/assets/img/healthcare/._vitals_1.png
new file mode 100755
index 0000000..cae923b
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._vitals_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/._vitals_2.png b/erpnext/docs/assets/img/healthcare/._vitals_2.png
new file mode 100755
index 0000000..77846b9
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/._vitals_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/docs/assets/img/healthcare/__init__.py
old mode 100644
new mode 100755
similarity index 100%
rename from erpnext/docs/assets/img/subscription/__init__.py
rename to erpnext/docs/assets/img/healthcare/__init__.py
diff --git a/erpnext/docs/assets/img/healthcare/appointment_1.png b/erpnext/docs/assets/img/healthcare/appointment_1.png
new file mode 100755
index 0000000..afd308d
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/appointment_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/appointment_2.png b/erpnext/docs/assets/img/healthcare/appointment_2.png
new file mode 100755
index 0000000..104a919
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/appointment_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/appointment_3.png b/erpnext/docs/assets/img/healthcare/appointment_3.png
new file mode 100755
index 0000000..004a978
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/appointment_3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/consultation_1.png b/erpnext/docs/assets/img/healthcare/consultation_1.png
new file mode 100755
index 0000000..a7bc60d
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/consultation_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/consultation_2.png b/erpnext/docs/assets/img/healthcare/consultation_2.png
new file mode 100755
index 0000000..fd5ceee
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/consultation_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/consultation_3.png b/erpnext/docs/assets/img/healthcare/consultation_3.png
new file mode 100755
index 0000000..e2804a9
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/consultation_3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/consultation_4.png b/erpnext/docs/assets/img/healthcare/consultation_4.png
new file mode 100755
index 0000000..3f9817c
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/consultation_4.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/home.png b/erpnext/docs/assets/img/healthcare/home.png
new file mode 100755
index 0000000..afe57a3
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/home.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/lab_test_1.png b/erpnext/docs/assets/img/healthcare/lab_test_1.png
new file mode 100755
index 0000000..b2ddbeb
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/lab_test_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/lab_test_2.png b/erpnext/docs/assets/img/healthcare/lab_test_2.png
new file mode 100755
index 0000000..c06732a
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/lab_test_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/medical_code_1.png b/erpnext/docs/assets/img/healthcare/medical_code_1.png
new file mode 100755
index 0000000..4497e5a
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/medical_code_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/medical_record_1.png b/erpnext/docs/assets/img/healthcare/medical_record_1.png
new file mode 100755
index 0000000..6058652
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/medical_record_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/medical_record_2.png b/erpnext/docs/assets/img/healthcare/medical_record_2.png
new file mode 100755
index 0000000..a482704
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/medical_record_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/module.png b/erpnext/docs/assets/img/healthcare/module.png
new file mode 100755
index 0000000..c795df1
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/module.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/patient_1.png b/erpnext/docs/assets/img/healthcare/patient_1.png
new file mode 100755
index 0000000..03728af
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/patient_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/patient_2.png b/erpnext/docs/assets/img/healthcare/patient_2.png
new file mode 100755
index 0000000..2a632c7
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/patient_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/patient_3.png b/erpnext/docs/assets/img/healthcare/patient_3.png
new file mode 100755
index 0000000..738ce2c
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/patient_3.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/physician_1.png b/erpnext/docs/assets/img/healthcare/physician_1.png
new file mode 100755
index 0000000..f570515
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/physician_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/physician_2.png b/erpnext/docs/assets/img/healthcare/physician_2.png
new file mode 100755
index 0000000..7b3d1ed
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/physician_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/physician_schedule_1.png b/erpnext/docs/assets/img/healthcare/physician_schedule_1.png
new file mode 100755
index 0000000..a9102e2
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/physician_schedule_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/physician_schedule_2.png b/erpnext/docs/assets/img/healthcare/physician_schedule_2.png
new file mode 100755
index 0000000..d910568
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/physician_schedule_2.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/sample_collection_1.png b/erpnext/docs/assets/img/healthcare/sample_collection_1.png
new file mode 100755
index 0000000..7623847
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/sample_collection_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/vitals_1.png b/erpnext/docs/assets/img/healthcare/vitals_1.png
new file mode 100755
index 0000000..43bf5bf
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/vitals_1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/healthcare/vitals_2.png b/erpnext/docs/assets/img/healthcare/vitals_2.png
new file mode 100755
index 0000000..3e2129a
--- /dev/null
+++ b/erpnext/docs/assets/img/healthcare/vitals_2.png
Binary files differ
diff --git a/erpnext/docs/user/manual/en/accounts/index.txt b/erpnext/docs/user/manual/en/accounts/index.txt
index 6a0da3a..41cb243 100644
--- a/erpnext/docs/user/manual/en/accounts/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/index.txt
@@ -6,6 +6,7 @@
 payments
 journal-entry
 payment-entry
+subscription
 multi-currency-accounting
 advance-payment-entry
 payment-request
diff --git a/erpnext/docs/user/manual/en/accounts/subscription.md b/erpnext/docs/user/manual/en/accounts/subscription.md
new file mode 100644
index 0000000..9afab58
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/subscription.md
@@ -0,0 +1,24 @@
+# Subscription
+
+If you have a contract with the Customer where your organization gives bill to the Customer on a monthly, quarterly, half-yearly or annual basis, you can use subscription feature to make auto invoicing.
+
+<img class="screenshot" alt="Subscription" src="/docs/assets/img/accounts/subscription.png">
+
+#### Scenario
+
+Subscription for your hosted ERPNext account requires yearly renewal. We use Sales Invoice for generating proforma invoices. To automate proforma invoicing for renewal, we set original Sales Invoice on the subscription form. Recurring proforma invoice is created automatically just before customer's account is about to expire, and requires renewal. This recurring Proforma Invoice is also emailed automatically to the customer.
+
+To set the subscription for the sales invoice
+Goto Subscription > select base doctype "Sales Invoice" > select base docname "Invoice No" > Save
+
+<img class="screenshot" alt="Subscription" src="/docs/assets/img/accounts/subscription.gif">
+
+**From Date and To Date**: This defines contract period with the customer.
+
+**Repeat on Day**: If frequency is set as Monthly, then it will be day of the month on which recurring invoice will be generated.
+
+**Notify By Email**: If you want to notify the user about auto recurring invoice.
+
+**Print Format**: Select a print format to define document view which should be emailed to customer.
+
+**Disabled**: It will stop to make auto recurring documents against the subscription
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/articles/creating-custom-link-field.md b/erpnext/docs/user/manual/en/customize-erpnext/articles/creating-custom-link-field.md
index 829015d..9a480bd 100644
--- a/erpnext/docs/user/manual/en/customize-erpnext/articles/creating-custom-link-field.md
+++ b/erpnext/docs/user/manual/en/customize-erpnext/articles/creating-custom-link-field.md
@@ -11,7 +11,7 @@
 
 ####Step 2: Select Form
 
-In Customize Form, select Document Type (Quotation, Sales Order, Purchase Invoice Item etc.). Once field are updated in table, open field before which you wish to insert Custom Field. Then click on "Insert Above" to insert new Custom Field.
+In Customize Form, select Document Type (Quotation, Sales Order, Purchase Invoice Item etc.). Once fields are updated in the accompanying table below, open a field above the one you wish to insert your Custom Field. Then click on "Insert Above" to insert the new Custom Field.
 
 <img alt="Select Docytpe" class="screenshot" src="/docs/assets/img/articles/link-field-1.gif">
 
@@ -26,4 +26,4 @@
 
 <img alt="Enter Values" class="screenshot" src="/docs/assets/img/articles/link-field-2.png">
 
-<!-- markdown -->
\ No newline at end of file
+<!-- markdown -->
diff --git a/erpnext/docs/user/manual/en/healthcare/._.DS_Store b/erpnext/docs/user/manual/en/healthcare/._.DS_Store
new file mode 100755
index 0000000..ed70b66
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/._.DS_Store
Binary files differ
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/docs/user/manual/en/healthcare/__init__.py
old mode 100644
new mode 100755
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/docs/user/manual/en/healthcare/__init__.py
diff --git a/erpnext/docs/user/manual/en/healthcare/appointment.md b/erpnext/docs/user/manual/en/healthcare/appointment.md
new file mode 100755
index 0000000..a5cea36
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/appointment.md
@@ -0,0 +1,38 @@
+# Patient Appointment
+ERPNext Healthcare allows you to book Patient appointments for any date and if configured, send them alerts via Email or SMS.
+
+You can create a Patient Appointment from
+> Healthcare > Patient Appointment > New Patient Appointment
+
+You can book appointments for a registered Patient by searching and selecting the Patient field. You can search the Patient by Patient ID, Name, Email or Mobile number. You can also register a new Patient from the Appointment screen by selecting "Create a new patient" in the Patient field.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/appointment_1.png">
+
+If you have a front desk executive to manage your appointments, you can configure a user role to have access to Patient Appointment so that she can do the bookings by selecting the Physician whom the Patient wish to consult and the date for booking. "Check Availability" button will pop up all the available time slots with status indicators for the date. She can select a time slot and "Book" the Appointment for the Patient.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/appointment_2.png">
+
+After Booking, the scheduled time of the Appointment and duration will be updated and seved in the document.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/appointment_3.png">
+
+You can configure ERPNext to send an SMS alert to the Patient about the booking confirmation or a reminder on the day of Appointment by doing necessary configurations in -
+
+> Healthcare > Healthcare Settings > Out Patient SMS Alerts
+
+The screen also allows the executive to select a Referring Physician so that you can track the source the appointment.
+
+### Actions
+  * Billing: If you collect the consultation fee while booking the Appointment itself you can do so by using the "Create > Invoice" button. This will take you to the ERPNext Accounts Sales Invoice screen.
+
+  * Vital Signs: "Create > Vital Signs" button will take you to the new Vital Signs screen to record the vitals of the Patient.
+
+  * Consultation: From the Appointment screen you can directly create a Consultation to record the details of patient encounter.
+
+  * View Patient Medical Record.
+
+> Note: User should have privileges (User Role) to view the buttons
+
+A Patient can also book an appointment with a Physician by checking the Physician's availability directly through the **ERPNext Portal**.
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/consultation.md b/erpnext/docs/user/manual/en/healthcare/consultation.md
new file mode 100755
index 0000000..a98713b
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/consultation.md
@@ -0,0 +1,28 @@
+# Consultation
+ERPNext Healthcare allows you to record Patient encounters through the Consultation document. You can create a Consultation based on a previously booked Appointment or directly by creating a new Consultation
+>Healthcare > Consultation > Consultation
+
+If you are creating the Consultation document from an Appointment, Patient and other related data will automatically be populated else you can search the Patient by name, email phone number etc. The Patient Details section will list the latest Vital Signs record of the patient and other information captured in the Patient screen.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/consultation_1.png">
+
+### Assessment
+
+Encounter Impression section allows you to select (or create new) Complaints and your assessment based on the presented complaints. You can opt to include the captured data in Consultation print by selecting the "In Print" flag
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/consultation_2.png">
+
+### Prescriptions
+
+You can prescribe medicines in the Drug Prescription section by selecting the drug codes (Stock Item) and appropriate dosages. If you are not managing Stock and Items are not configured, you can simply enter the Medicine name and strength in the Strength field which will printed.
+
+Prescribing a laboratory investigation is similar and if you have Lab Tests configured, you can select from the list. Or key in the Lab Test name to be printed as part of the Prescription.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/consultation_3.png">
+
+### Medical Coding
+You can also attach one or more Medical Codes to designate the Diagnosis in the Medical Coding Section. You will have to select the Medical Code Standard you wish to encode the diagnosis and then select the Code by searching the Code itself or the Code Description.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/consultation_4.png">
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/index.md b/erpnext/docs/user/manual/en/healthcare/index.md
new file mode 100755
index 0000000..85e3b6f
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/index.md
@@ -0,0 +1,13 @@
+# Healthcare
+
+ERPNext Healthcare helps you manage your Clinic or Practice efficiently by scheduling **Appointments** and  recording **Patient Encounters** (Consultations). You can easily pull out a **Patient's Health Record** anytime to review all the history of treatments assisting you in providing effective, high quality care.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/module.png">
+
+Patients can view various documents relevant to them and book Appointments via the **ERPNext Portal**. The healthcare module is integrated with  **Accounts** and **Human Resources** modules, helping you in **Billing**, **Payroll Management** etc. and benefit from other rich features of ERPNext. You can configure the **Selling** and **Stock** modules manage your Pharmacy.
+
+ERPNext Healthcare also includes features for effectively managing the functions of an associated **Laboratory** by helping you record **Sample Collection**, emailing and printing **Lab Test** results etc. ERPNext Healthcare allows you to upload **Medical Code Standards** like **ICD10** and attach to Consultations.
+
+### Topics
+
+{index}
diff --git a/erpnext/docs/user/manual/en/healthcare/index.txt b/erpnext/docs/user/manual/en/healthcare/index.txt
new file mode 100755
index 0000000..471d91d
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/index.txt
@@ -0,0 +1,12 @@
+patient
+appointment
+vital_signs
+consultation
+medical_record
+sample_collection
+lab_test
+invoicing
+physician
+physician_schedule
+medical_codes
+setup
diff --git a/erpnext/docs/user/manual/en/healthcare/invoicing.md b/erpnext/docs/user/manual/en/healthcare/invoicing.md
new file mode 100755
index 0000000..bc9dead
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/invoicing.md
@@ -0,0 +1,8 @@
+# Invoicing
+Billing is an integral part of any undertaking and ERPNext Healthcare achieves this by making use of the ERPNext Accounts module.
+
+> Note: All transactions of a Patient is booked against the Customer which it is linked to.
+
+All ERPNext Healthcare documents which require Invoicing will have buttons which would take you to the Sales Invoice with the Items configured for the service. You can then proceed by following the ERPNExt Accounts module workflows. Please note that your User account should have appropriate privileges to access the Accounts documents.
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/lab_test.md b/erpnext/docs/user/manual/en/healthcare/lab_test.md
new file mode 100755
index 0000000..bdf0cfc
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/lab_test.md
@@ -0,0 +1,22 @@
+# Lab Test
+
+ERPNext Healthcare allows you to manage a clinical laboratory efficiently by allowing you to enter Lab Tests and print or email test results, manage samples collected, create Invoice etc. ERPNext Healthcare comes pre-packed with some sample tests, you can reconfigure Lab Test Templates for each Test and its result format or crate new ones. You can do this in
+>Healthcare > Setup > Lab Text Templates
+
+Once you have all necessary Lab Test Templates configured, you can start creating Lab Tests by selecting a Test Template every time you create a Test. To create a new Lab Test
+>Healthcare > Laboratory > Lab Test > New Lab Test
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/lab_test_1.png">
+
+You can record the test results in the Lab Test document as the results gets ready.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/lab_test_2.png">
+
+> Note: To create Sample Collection documents for every Lab Test, check "Manage Sample Collection" flag in Healthcare Settings and select Sample in the Lab Test Template
+
+In many Laboratories, approval of Lab Tests is a must before printing and submitting the document. ERPNext Healthcare allows you to create Users with Role "Lab Test Approver" for this. You will also have to enable this in
+>Healthcare Settings > Laboratory Settings > Require Lab Test Approval
+
+This will ensure that emailing or printing of Lab Tests can only be done after Approval of the Lab Test by the Lab Test Approver.
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/medical_codes.md b/erpnext/docs/user/manual/en/healthcare/medical_codes.md
new file mode 100755
index 0000000..c0997b1
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/medical_codes.md
@@ -0,0 +1,9 @@
+# Medical Code Standards
+Medical Coding are in many countries required for regulatory compliance and many of the Medical Insurance companies do that pricing based on Medical Code standards. ERPNext Healthcare offers support, however limited, to encode diagnosis and assessments recorded as part of Consultation. This can be done if you configure the Medical Code Standard and related Medical Codes - this is easily done by data import as the code data tends to be quite large. You can create as many Medical Code Standards you wish
+> Healthcare > Masters > Medical Code Standard
+
+Medical Code Standard document is used to name the Code Standard and act as a container for all the medical codes which are standardized under it. Medical Codes and descriptions can then be imported to the Medical Code document, after ensuring that you set the Medical Code Standard field to the appropriate Standard name.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/medical_code_1.png">
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/medical_record.md b/erpnext/docs/user/manual/en/healthcare/medical_record.md
new file mode 100755
index 0000000..9d2697d
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/medical_record.md
@@ -0,0 +1,13 @@
+# Patient Medical Record
+The maintenance of complete and accurate medical records is a requirement of healthcare providers and is critical in rendering effective, high quality care. ERPNext Healthcare allows you to draw up the treatment history of a Patient anytime by merely selecting the Patient. "Medical Record" button is available in various screens so that you can easily switch to the Medical Record page to view the patient history.
+
+Medical Record automatically keeps track of all Consultations, recorded Vital Signs, Lab Investigations etc. Complaints, Diagnosis etc. captured as part of consultation are easily viewable but to look at the details of other documents, links are provided.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/medical_record_1.png">
+
+##### Adding notes manually to Medical Record
+In the Patient screen Create > Medical Record will allow you to record notes to the Medical Record manually. You can also attach files when doing this, and the Medical Record will display links to the attached file along side the notes. Create > Medical Record button is also made available in the Consultation screen
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/medical_record_2.png">
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/patient.md b/erpnext/docs/user/manual/en/healthcare/patient.md
new file mode 100755
index 0000000..ed6810e
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/patient.md
@@ -0,0 +1,43 @@
+# Patient
+
+In ERPNext Healthcare, the Patient document corresponds any individual who is the recipient of healthcare services you provide. For every ERPNext Healthcare document, it is important to have a Patient associated with it. You can create a new Patient from
+> Healthcare > Masters > Patient > New Patient
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/patient_1.png">
+
+The Patient document holds most details that are required to identify and qualify a patient. You can enter as much information available while creating the Patient. All information in the patient document is presented on the Consultation screen for easy lookup and you can always update this information. Other data like observations, vital signs etc. are not part of the Patient document. These could be recorded during patient encounters and will be available as part of the Patient Medical Record.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/patient_2.png">
+
+### Patient as a Customer
+
+ERPNext Accounts makes use of "Customer" document for booking all transactions. So, you may want to associate every Patient to be associated with a Customer in ERPNext. By default, ERPNext Healthcare creates a Customer alongside a Patient and links to it - every transaction against a Patient is booked against the associated Customer. If, for some reason you do not intend to use the ERPNext Accounts module you can turn this behavior off by unchecking this flag
+>Healthcare > Setup > Healthcare Settings > Manage Customer
+
+In many cases, you may want to associate multiple Patients to a single Customer against whom you want to book the transactions. For instance, a Veterinarian would require the care services provided to different pets of an individual invoiced against a single Customer.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/patient_3.png">
+
+The Patient Relation section of the Patient allows you to select how a Patient is related to another Patient in the system. This is optional, but will be quite handy if you want to use ERPNext in a fertility clinic, for example.
+
+### Registration Fee
+Many clinical facilities collect a registration fee during Registration. You can turn this feature on and set the registration fee amount by checking this flag
+> Healthcare > Setup > Healthcare Settings > Collect Fee for Patient Registration
+
+If you have this enabled, all new Patients you create will by default be in Disabled mode and will be enabled only after Invoicing the Registration Fee. To create Invoice and record the payment receipt, you can use the "Invoice Patient Registration" button in the Patient document.
+
+> Note: For all ERPNext Healthcare documents, "Disabled" Patients are filtered out.
+
+### Grant access to Patient Portal
+ERPNext Healthcare allows you to create a portal user associated with a Patient by simply entering the user email id. A welcome email will be sent to the Patient email address to "Complete" registration.
+
+### Actions
+From the Patient document, the following links are enabled
+
+* Vital Signs: "Create > Vital Signs" button will take you to the new Vital Signs screen to record the vitals of the Patient.
+
+* View Patient Medical Record.
+
+* Consultation: You can directly create a new Consultation to record the details of patient encounter.
+
+> Note: User should have privileges (User Role) to view the buttons
diff --git a/erpnext/docs/user/manual/en/healthcare/physician.md b/erpnext/docs/user/manual/en/healthcare/physician.md
new file mode 100755
index 0000000..7b7995b
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/physician.md
@@ -0,0 +1,18 @@
+# Physician
+ERPNext Healthcare allows you to create multiple physicians and optionally link to a User with appropriate Roles. You can create a Physician here -
+>Healthcare > Masters > Physician
+
+Linking a User to the Physician makes the system populate the Physician field in all documents to the Physician associated with the logged in User.
+>Note: You should also relate the User to an Employee to utilize the various features of Human Resources module.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/physician_1.png">
+
+### Scheduling and Availability
+Each Physician can have a "Physician Schedule" and a "Time per Appointment" on the basis of which, the scheduler will book Appointments. Also, you can select appropriate Income Accounts for a Physician to book all Consultation charges into separate accounts.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/physician_2.png">
+
+### Referring Physicians
+You may also want to manage a list of Doctors who refers Patients to your facility. You can manage such data in the Physician document itself by leaving out the User link.
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/physician_schedule.md b/erpnext/docs/user/manual/en/healthcare/physician_schedule.md
new file mode 100755
index 0000000..0da7896
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/physician_schedule.md
@@ -0,0 +1,13 @@
+# Physician Schedule
+Physician Schedule will help you to configure the availability and work hours of Physicians. You can then select an applicable schedule for each Physician.
+
+You can create Physician Schedule from -
+> Healthcare > Masters > Physician Schedule
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/physician_schedule_1.png">
+
+After naming the schedule you can use the "Add Time Slots" button to create time slots for each day of the week. These time slots will then be displayed while checking the availability of a Physician when booking an Appointment.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/physician_schedule_2.png">
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/sample_collection.md b/erpnext/docs/user/manual/en/healthcare/sample_collection.md
new file mode 100755
index 0000000..3473daf
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/sample_collection.md
@@ -0,0 +1,13 @@
+# Sample Collection
+It's critical for a Laboratory to manage collected samples and you may want to ID the sample, print stickers etc. ERPNext Healthcare "Sample Collection" document helps you to easily manage the sample collection process by creating a sample collection document for every Lab Test automatically. You will have to turn on the flag in Healthcare Settings to enable this feature.
+> Healthcare Settings > Laboratory Settings > Manage Sample Collection
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/sample_collection_1.png">
+
+> Note: You will have to select a Sample in the Lab Test Template for the system to automatically create a Sample Collection document
+
+You will have to enter the sample collected date and time to Submit the document signaling that the sample is collected.
+
+Printing on sample identification tags is also possible. By default a sample sticker print template is made available, but you can always create a custom Print Format by using "Customize" button in the print preview.
+
+{next}
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/docs/user/manual/en/healthcare/setup/__init__.py
old mode 100644
new mode 100755
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/docs/user/manual/en/healthcare/setup/__init__.py
diff --git a/erpnext/docs/user/manual/en/healthcare/setup/index.md b/erpnext/docs/user/manual/en/healthcare/setup/index.md
new file mode 100755
index 0000000..721f521
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/setup/index.md
@@ -0,0 +1,7 @@
+# Setup
+
+Once you setup ERPNext (Company, Chart Of Accounts etc.), you can start with setting up your domain. To setup Healthcare module, User should have Healthcare Admin Role enabled. You can configure each of the departments as detailed in the Topics below.
+
+### Topics
+
+{index}
diff --git a/erpnext/docs/user/manual/en/healthcare/setup/index.txt b/erpnext/docs/user/manual/en/healthcare/setup/index.txt
new file mode 100755
index 0000000..f242381
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/setup/index.txt
@@ -0,0 +1,3 @@
+Setting up Practice Management
+Setting up Laboratory
+Setting up Pharmacy (Stock)
diff --git a/erpnext/docs/user/manual/en/healthcare/setup/setup_laboratory.md b/erpnext/docs/user/manual/en/healthcare/setup/setup_laboratory.md
new file mode 100755
index 0000000..93e53b8
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/setup/setup_laboratory.md
@@ -0,0 +1,67 @@
+# Laboratory
+
+If you wish to use features of Laboratory, you can create Users with "Laboratory User". Lab Tests, Sample Collection etc. are only visible to users with this Role enabled.
+
+### Laboratory Settings
+> Healthcare > Setup > Healthcare Settings > Laboratory Settings
+
+* Manage Sample Collection - If this flag is enabled, every time you create a Lab Test, a Sample Collection document will be created.
+
+* Require Lab Test Approval - Turning this on will restrict printing and emailing of Lab Tests only if the documents are in Approved status. You can use this flag to ensure that every Test result leaves your facility after verification.
+
+* Enable the third option if you want the name and designation of the Employee associated with the User who submits the document to be printed in the Lab Test Report.
+
+##### SMS Alerts
+You can configure ERPNext Healthcare to alert Patients via SMS when the Lab Test result gets ready (Submit) and when you Email the result. You an configure the templates for the SMS as registered with your provider here.
+> Healthcare > Setup > Healthcare Settings > Laboratory SMS Alerts
+
+
+### Lab Test Templates
+Whenever you create a new Lab Test, the Lab Test document is loaded based on the template configured for that particular test. This means, you will have to have separate templates configured for each Lab Test.
+
+Here's how you can configure various types of templates.
+> Healthcare > Setup > Lab Test Template > New Lab Test Template
+
+After providing the Name for the Test you will have to select a Code and Item group for creating the mapped Item. ERPNext Healthcare maps every Lab Test (every other billable healthcare service) to an Item with "Maintain Stock" set to false. This way, the Accounts Module will invoice the Item and you can see the Sales related reports of Selling Module. You can also set selling rate of the Lab Test here - this will update the Selling Price List.
+
+> The Standard Selling Rate field behaves similar to the Item Standard Selling Rate, updating this will not update the Selling Price List
+
+The Is Billable flag in Lab Test Template creates the Item, but as Disabled. Likewise, unchecking this flag will Enable the Item.
+
+###### Result Format
+Following are the result formats available in ERPNext Healthcare
+
+* Single - select this format for results which require only a single input, result UOM and normal value
+* Compound - allows you to configure results which require multiple input fields with corresponding event names, result UOMs and normal values
+* Descriptive - this format is helpful for results which have multiple result components and corresponding result entry fields.
+* Grouped - You can group test templates which are already configured and combine as a single test. For such templates select "Grouped".
+* No Result - Select this if you don not need to enter or manage test result. Also, no Lab Test document will be created. e.g., Sub Tests for Grouped results.
+
+###### Normal values
+For Single and Compound result formats, you can set the normal values.
+
+###### Sample
+You will have to select the Sample required for the test. You can also mention the quantity of sample that needs to be collected. These details will be used when creating the Sample Collection document for the Lab Test.
+
+### Medical Department
+To organize your clinic into departments, you can create multiple Medical Departments. You can select appropriate departments in Lab Test Template and will be included in the Lab Test result print.
+> Healthcare > Setup > Medical Department > New Medical Department
+
+### Lab Test Sample
+You can create various masters for Samples that are to be collected for a Lab Test.
+> Healthcare > Setup > Lab Test Sample > New Lab Test Sample
+
+
+### Lab Test UOM
+You can create various masters for Unit of Measures to be used in Lab Test document.
+> Healthcare > Setup > Lab Test UOM > New Lab Test UOM
+
+### Antibiotic
+You can create masters for a list of Antibiotics.
+> Healthcare > Setup > Antibiotic > New Antibiotic
+
+### Sensitivity
+You can create masters for a list of Sensitivity to various Antibiotics.
+> Healthcare > Setup > Sensitivity > New Sensitivity
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/setup/setup_pharmacy.md b/erpnext/docs/user/manual/en/healthcare/setup/setup_pharmacy.md
new file mode 100755
index 0000000..7f9c719
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/setup/setup_pharmacy.md
@@ -0,0 +1,4 @@
+# Pharmacy
+ERPNext Healthcare do not have a Pharmacy module - but you can configure the Stock module to manage your stock and Accounts and Buying modules for Billing and Purchases. The stock module allows you to configure Items with serial numbers and Batches. Expiry dates can be set if you turn on the "Has Batch No" check. You can also configure the auto reorder levels if required.
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/setup/setup_practice.md b/erpnext/docs/user/manual/en/healthcare/setup/setup_practice.md
new file mode 100755
index 0000000..8160482
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/setup/setup_practice.md
@@ -0,0 +1,38 @@
+# Clinic / Practice
+Configuring ERPNext Healthcare for your practice is simple.
+> Healthcare > Setup > Healthcare Settings > Out Patient Settings
+
+By default Patient document uses the patient name as the name, but you can opt to use a naming series if required.
+
+The "Manage Customer" option will enable the system to create and link a Customer whenever a new Patient is created. This Customer is used while booking all transactions.
+
+Here, you can also select the default Medical Code Standard to use.
+
+###### Collect Fee for Patient Registration
+If you enable this, all new Patients you create will by default be in Disabled mode and will be enabled only after Invoicing the Registration Fee. To create Invoice and record the payment receipt, you can use the "Invoice Patient Registration" button in the Patient document. Also note that all ERPNext Healthcare documents, "Disabled" Patients are filtered out. You can set the registration fee to be collected here.
+
+###### Consultation Fee validity
+Many healthcare facilities do not charge for follow up consultations within a time period after the first visit. You can configure the number of free visits allowed as well as the time period for free consultations here.
+
+### Medical Department
+To organize your clinic into departments, you can create multiple Medical Departments.
+> Healthcare > Setup > Medical Department > New Medical Department
+
+### Appointment Type
+You can create masters for various type of Appointments. This is optional and not considered while appointment scheduling.
+> Healthcare > Setup > Appointment Type > New Appointment Type
+
+### Prescription Dosage & Duration
+You can configure different dosages to be used while prescribing medication to patients. You can name the Prescription dosage in anyway you want (for example, BID or I-0-I), and then set the strength of the drug and the times at which it should be administered.
+> Healthcare > Setup > Prescription Dosage > New Prescription Dosage
+
+> Healthcare > Setup > Prescription Duration > New Prescription Duration
+
+### Complaint and Diagnosis
+To ease the data entry while recording the encounter impression, ERPNext Healthcare allows you to save each of the Complaint / Diagnosis data you enter, from the Consultation screen itself. This way, the database keeps building a list of all complaints and diagnosis you entered. Later on, every time you start keying in, you will be able to select the previously entered word / sentence from the search field. You can also configure the masters manually.
+
+> Healthcare > Setup > Complaints > New Complaint
+
+> Healthcare > Setup > Diagnosis > New Diagnosis
+
+{next}
diff --git a/erpnext/docs/user/manual/en/healthcare/vital_signs.md b/erpnext/docs/user/manual/en/healthcare/vital_signs.md
new file mode 100755
index 0000000..21b25d9
--- /dev/null
+++ b/erpnext/docs/user/manual/en/healthcare/vital_signs.md
@@ -0,0 +1,13 @@
+# Vital Signs
+ERPNext Healthcare allows you to record Vital Signs of Patients and manage this information as part of the Patient's health record. You can create a new document and record Vital Signs of a Patient from most of the Healthcare documents or directly by
+> Healthcare > Consultation > Vital Signs > New Vital Signs
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/vitals_1.png">
+
+You can select the Patient for whom you are recording the vitals and start by entering each of the fields. Normal values or ranges are provided for ease of assessment. Also present is an auto BMI calculator.
+
+<img class="screenshot" alt="ERPNext Healthcare" src="/docs/assets/img/healthcare/vitals_2.png">
+
+All recorded Vital Signs are made available in the Patient Medical Record and the last recorded Vital Sign is displayed on the left hand side pane for easy review.
+
+{next}
diff --git a/erpnext/subscription/__init__.py b/erpnext/healthcare/__init__.py
similarity index 100%
rename from erpnext/subscription/__init__.py
rename to erpnext/healthcare/__init__.py
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/__init__.py
similarity index 100%
rename from erpnext/subscription/doctype/__init__.py
rename to erpnext/healthcare/doctype/__init__.py
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/antibiotic/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/antibiotic/__init__.py
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.js b/erpnext/healthcare/doctype/antibiotic/antibiotic.js
new file mode 100644
index 0000000..42e6adb
--- /dev/null
+++ b/erpnext/healthcare/doctype/antibiotic/antibiotic.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Antibiotic', {
+});
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.json b/erpnext/healthcare/doctype/antibiotic/antibiotic.json
new file mode 100644
index 0000000..d481036
--- /dev/null
+++ b/erpnext/healthcare/doctype/antibiotic/antibiotic.json
@@ -0,0 +1,115 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:antibiotic_name", 
+ "beta": 1, 
+ "creation": "2016-02-23 11:11:30.749731", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "antibiotic_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Antibiotic Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:44:43.199657", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Antibiotic", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 0
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "antibiotic_name", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "antibiotic_name", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.py b/erpnext/healthcare/doctype/antibiotic/antibiotic.py
new file mode 100644
index 0000000..8236c8a
--- /dev/null
+++ b/erpnext/healthcare/doctype/antibiotic/antibiotic.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class Antibiotic(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/antibiotic/test_antibiotic.js b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.js
new file mode 100644
index 0000000..b92103d
--- /dev/null
+++ b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Antibiotic", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Antibiotic
+		() => frappe.tests.make('Antibiotic', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
new file mode 100644
index 0000000..6ac4f4f
--- /dev/null
+++ b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestAntibiotic(unittest.TestCase):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/appointment_type/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/appointment_type/__init__.py
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.js b/erpnext/healthcare/doctype/appointment_type/appointment_type.js
new file mode 100644
index 0000000..15916a5
--- /dev/null
+++ b/erpnext/healthcare/doctype/appointment_type/appointment_type.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Appointment Type', {
+});
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.json b/erpnext/healthcare/doctype/appointment_type/appointment_type.json
new file mode 100644
index 0000000..4b34892
--- /dev/null
+++ b/erpnext/healthcare/doctype/appointment_type/appointment_type.json
@@ -0,0 +1,145 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 1, 
+ "autoname": "field:appointment_type", 
+ "beta": 1, 
+ "creation": "2016-07-22 11:52:34.953019", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "appointment_type", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "ip", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Is Inpatient", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:46:57.142289", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Appointment Type", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "appointment_type", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.py b/erpnext/healthcare/doctype/appointment_type/appointment_type.py
new file mode 100644
index 0000000..1dacffa
--- /dev/null
+++ b/erpnext/healthcare/doctype/appointment_type/appointment_type.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class AppointmentType(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/appointment_type/test_appointment_type.js b/erpnext/healthcare/doctype/appointment_type/test_appointment_type.js
new file mode 100644
index 0000000..93274e5
--- /dev/null
+++ b/erpnext/healthcare/doctype/appointment_type/test_appointment_type.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Appointment Type", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Appointment Type
+		() => frappe.tests.make('Appointment Type', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/appointment_type/test_appointment_type.py b/erpnext/healthcare/doctype/appointment_type/test_appointment_type.py
new file mode 100644
index 0000000..04452e4
--- /dev/null
+++ b/erpnext/healthcare/doctype/appointment_type/test_appointment_type.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+# test_records = frappe.get_test_records('Appointment Type')
+
+class TestAppointmentType(unittest.TestCase):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/codification_table/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/codification_table/__init__.py
diff --git a/erpnext/healthcare/doctype/codification_table/codification_table.json b/erpnext/healthcare/doctype/codification_table/codification_table.json
new file mode 100644
index 0000000..c411778
--- /dev/null
+++ b/erpnext/healthcare/doctype/codification_table/codification_table.json
@@ -0,0 +1,135 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-06-22 13:09:23.159579", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "medical_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Medical Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Medical Code", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "code", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "medical_code.code", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "medical_code.description", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:06:50.281545", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Codification Table", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/codification_table/codification_table.py b/erpnext/healthcare/doctype/codification_table/codification_table.py
new file mode 100644
index 0000000..ae29c03
--- /dev/null
+++ b/erpnext/healthcare/doctype/codification_table/codification_table.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class CodificationTable(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/complaint/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/complaint/__init__.py
diff --git a/erpnext/healthcare/doctype/complaint/complaint.js b/erpnext/healthcare/doctype/complaint/complaint.js
new file mode 100644
index 0000000..5a2d219
--- /dev/null
+++ b/erpnext/healthcare/doctype/complaint/complaint.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Complaint', {
+});
diff --git a/erpnext/healthcare/doctype/complaint/complaint.json b/erpnext/healthcare/doctype/complaint/complaint.json
new file mode 100644
index 0000000..0899a39
--- /dev/null
+++ b/erpnext/healthcare/doctype/complaint/complaint.json
@@ -0,0 +1,116 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:complaints", 
+ "beta": 1, 
+ "creation": "2017-02-15 12:25:28.045267", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "complaints", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Complaints", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:44:31.848346", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Complaint", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "complaints", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "complaints", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/complaint/complaint.py b/erpnext/healthcare/doctype/complaint/complaint.py
new file mode 100644
index 0000000..717f9db
--- /dev/null
+++ b/erpnext/healthcare/doctype/complaint/complaint.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class Complaint(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/complaint/test_complaint.js b/erpnext/healthcare/doctype/complaint/test_complaint.js
new file mode 100644
index 0000000..9ff44d8
--- /dev/null
+++ b/erpnext/healthcare/doctype/complaint/test_complaint.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Complaint", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Complaint
+		() => frappe.tests.make('Complaint', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/complaint/test_complaint.py b/erpnext/healthcare/doctype/complaint/test_complaint.py
new file mode 100644
index 0000000..2b9273a
--- /dev/null
+++ b/erpnext/healthcare/doctype/complaint/test_complaint.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestComplaint(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/consultation/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/consultation/__init__.py
diff --git a/erpnext/healthcare/doctype/consultation/consultation.js b/erpnext/healthcare/doctype/consultation/consultation.js
new file mode 100644
index 0000000..15a1c7f
--- /dev/null
+++ b/erpnext/healthcare/doctype/consultation/consultation.js
@@ -0,0 +1,317 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Consultation', {
+	setup: function(frm) {
+		frm.get_field('drug_prescription').grid.editable_fields = [
+			{fieldname: 'drug_code', columns: 2},
+			{fieldname: 'drug_name', columns: 2},
+			{fieldname: 'dosage', columns: 2},
+			{fieldname: 'period', columns: 2}
+		];
+		frm.get_field('test_prescription').grid.editable_fields = [
+			{fieldname: 'test_code', columns: 2},
+			{fieldname: 'test_name', columns: 4},
+			{fieldname: 'test_comment', columns: 4}
+		];
+	},
+	onload: function(frm){
+		if(frm.doc.patient){
+			frappe.call({
+				"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
+				args: {
+					patient: frm.doc.patient
+				},
+				callback: function (data) {
+					var age = null;
+					if(data.message.dob){
+						age = calculate_age(data.message.dob);
+					}
+					frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
+					show_details(data.message);
+				}
+			});
+		}
+	},
+	refresh: function(frm) {
+		refresh_field('drug_prescription');
+		refresh_field('test_prescription');
+
+		frm.add_custom_button(__('Medical Record'), function() {
+			if (frm.doc.patient) {
+				frappe.route_options = {"patient": frm.doc.patient};
+				frappe.set_route("medical_record");
+			} else {
+				frappe.msgprint("Please select Patient");
+			}
+		},"View");
+		frm.add_custom_button(__('Vital Signs'), function() {
+			btn_create_vital_signs(frm);
+		},"Create");
+		frm.add_custom_button(__('Medical Record'), function() {
+			create_medical_record(frm);
+		},"Create");
+
+		frm.set_query("patient", function () {
+			return {
+				filters: {"disabled": 0}
+			};
+		});
+		frm.set_query("drug_code", "drug_prescription", function() {
+			return {
+				filters: {
+					is_stock_item:'1'
+				}
+			};
+		});
+		frm.set_query("test_code", "test_prescription", function() {
+			return {
+				filters: {
+					is_billable:'1'
+				}
+			};
+		});
+		frm.set_query("medical_code", "codification_table", function() {
+			return {
+				filters: {
+					medical_code_standard: frappe.defaults.get_default("default_medical_code_standard")
+				}
+			};
+		});
+		frm.set_query("appointment", function() {
+			return {
+				filters: {
+					//	Scheduled filter for demo ...
+					status:['in',["Open","Scheduled"]]
+				}
+			};
+		});
+		if(!frm.doc.__islocal && !frm.doc.invoice && (frappe.user.has_role("Accounts User"))){
+			frm.add_custom_button(__('Invoice'), function() {
+				btn_invoice_consultation(frm);
+			},__("Create"));
+		}
+		frm.set_df_property("appointment", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("patient", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("patient_age", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("patient_sex", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("type", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("physician", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("visit_department", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("consultation_date", "read_only", frm.doc.__islocal ? 0:1);
+		frm.set_df_property("consultation_time", "read_only", frm.doc.__islocal ? 0:1);
+	}
+});
+
+var btn_invoice_consultation = function(frm){
+	var doc = frm.doc;
+	frappe.call({
+		method:
+		"erpnext.healthcare.doctype.consultation.consultation.create_invoice",
+		args: {company: doc.company, patient: doc.patient, physician: doc.physician, consultation_id: doc.name },
+		callback: function(data){
+			if(!data.exc){
+				if(data.message){
+					frappe.set_route("Form", "Sales Invoice", data.message);
+				}
+				cur_frm.reload_doc();
+			}
+		}
+	});
+};
+
+var create_medical_record = function (frm) {
+	if(!frm.doc.patient){
+		frappe.throw("Please select patient");
+	}
+	frappe.route_options = {
+		"patient": frm.doc.patient,
+		"status": "Open",
+		"reference_doctype": "Patient Medical Record",
+		"reference_owner": frm.doc.owner
+	};
+	frappe.new_doc("Patient Medical Record");
+};
+
+var btn_create_vital_signs = function (frm) {
+	if(!frm.doc.patient){
+		frappe.throw("Please select patient");
+	}
+	frappe.route_options = {
+		"patient": frm.doc.patient,
+	};
+	frappe.new_doc("Vital Signs");
+};
+
+var show_details = function(data){
+	var personal_details = "";
+	var age = null;
+	if(data.dob){
+		age = calculate_age(data.dob);
+		personal_details += "<br><b>Age :</b> " + age;
+	}
+	if(data.sex) personal_details += "<br><b>Gender :</b> " + data.sex;
+	if(data.blood_group) personal_details += "<br><b>Blood group : </b> " + data.blood_group;
+	if(data.occupation) personal_details += "<br><b>Occupation :</b> " + data.occupation;
+	if(data.email) personal_details += "<br><b>Email :</b> " + data.email;
+	if(data.mobile) personal_details += "<br><b>Mobile :</b> " + data.mobile;
+
+	if(personal_details){
+		personal_details = "<div style='padding-left:10px; font-size:13px;' align='left'></br><b class='text-muted'>Personal Details</b>" + personal_details + "</div>";
+	}
+
+	var details = "";
+	if(data.allergies) details +=  "<br><br><b>Allergies : </b> "+  data.allergies;
+	if(data.medication) details +=  "<br><b>Medication : </b> "+  data.medication;
+	if(data.alcohol_current_use) details +=  "<br><br><b>Alcohol use : </b> "+  data.alcohol_current_use;
+	if(data.alcohol_past_use) details +=  "<br><b>Alcohol past use : </b> "+  data.alcohol_past_use;
+	if(data.tobacco_current_use) details +=  "<br><b>Tobacco use : </b> "+  data.tobacco_current_use;
+	if(data.tobacco_past_use) details +=  "<br><b>Tobacco past use : </b> "+  data.tobacco_past_use;
+	if(data.medical_history) details +=  "<br><br><b>Medical history : </b> "+  data.medical_history;
+	if(data.surgical_history) details +=  "<br><b>Surgical history : </b> "+  data.surgical_history;
+	if(data.surrounding_factors) details +=  "<br><br><b>Occupational hazards : </b> "+  data.surrounding_factors;
+	if(data.other_risk_factors) details += "<br><b>Other risk factors : </b> " + data.other_risk_factors;
+	if(data.patient_details) details += "<br><br><b>More info : </b> " + data.patient_details;
+
+	if(details){
+		details = "<div style='padding-left:10px; font-size:13px;' align='left'></br><b class='text-muted'>Patient Details</b>" + details + "</div>";
+	}
+
+	var vitals = "";
+	if(data.temperature) vitals += "<br><b>Temperature :</b> " + data.temperature;
+	if(data.pulse) vitals += ", <b>Pulse :</b> " + data.pulse;
+	if(data.respiratory_rate) vitals += ", <b>Respiratory Rate :</b> " + data.respiratory_rate;
+	if(data.bp) vitals += ", <b>BP :</b> " + data.bp;
+	if(data.bmi) vitals += "<br><b>BMI :</b> " + data.bmi;
+	if(data.nutrition_note) vitals += " (" + data.nutrition_note + ")";
+	if(data.height) vitals += ", <b>Height :</b> " + data.height;
+	if(data.weight) vitals += ", <b>Weight :</b> " + data.weight;
+	if(data.signs_date) vitals += "<br><b>Date :</b> " + data.signs_date;
+
+	if(vitals){
+		vitals = "<div style='padding-left:10px; font-size:13px;' align='left'></br><b class='text-muted'>Vital Signs</b>" + vitals + "<br></div>";
+	}
+	details = personal_details + vitals + details;
+	cur_frm.fields_dict.patient_details_html.$wrapper.html(details);
+};
+
+frappe.ui.form.on("Consultation", "appointment", function(frm){
+	if(frm.doc.appointment){
+		frappe.call({
+			"method": "frappe.client.get",
+			args: {
+				doctype: "Patient Appointment",
+				name: frm.doc.appointment
+			},
+			callback: function (data) {
+				frappe.model.set_value(frm.doctype,frm.docname, "patient", data.message.patient);
+				frappe.model.set_value(frm.doctype,frm.docname, "type", data.message.appointment_type);
+				frappe.model.set_value(frm.doctype,frm.docname, "physician", data.message.physician);
+				frappe.model.set_value(frm.doctype,frm.docname, "invoice", data.message.sales_invoice);
+			}
+		});
+	}
+});
+
+frappe.ui.form.on("Consultation", "physician", function(frm) {
+	if(frm.doc.physician){
+		frappe.call({
+			"method": "frappe.client.get",
+			args: {
+				doctype: "Physician",
+				name: frm.doc.physician
+			},
+			callback: function (data) {
+				frappe.model.set_value(frm.doctype,frm.docname, "visit_department",data.message.department);
+			}
+		});
+	}
+});
+
+frappe.ui.form.on("Consultation", "symptoms_select", function(frm) {
+	if(frm.doc.symptoms_select){
+		var symptoms = null;
+		if(frm.doc.symptoms)
+			symptoms = frm.doc.symptoms + "\n" +frm.doc.symptoms_select;
+		else
+			symptoms = frm.doc.symptoms_select;
+		frappe.model.set_value(frm.doctype,frm.docname, "symptoms", symptoms);
+		frappe.model.set_value(frm.doctype,frm.docname, "symptoms_select", null);
+	}
+});
+frappe.ui.form.on("Consultation", "diagnosis_select", function(frm) {
+	if(frm.doc.diagnosis_select){
+		var diagnosis = null;
+		if(frm.doc.diagnosis)
+			diagnosis = frm.doc.diagnosis + "\n" +frm.doc.diagnosis_select;
+		else
+			diagnosis = frm.doc.diagnosis_select;
+		frappe.model.set_value(frm.doctype,frm.docname, "diagnosis", diagnosis);
+		frappe.model.set_value(frm.doctype,frm.docname, "diagnosis_select", null);
+	}
+});
+
+frappe.ui.form.on("Consultation", "patient", function(frm) {
+	if(frm.doc.patient){
+		frappe.call({
+			"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
+			args: {
+				patient: frm.doc.patient
+			},
+			callback: function (data) {
+				var age = "";
+				if(data.message.dob){
+					age = calculate_age(data.message.dob);
+				}
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_sex", data.message.sex);
+				if(frm.doc.__islocal) show_details(data.message);
+			}
+		});
+	}
+});
+
+frappe.ui.form.on("Drug Prescription", {
+	drug_code:  function(frm, cdt, cdn) {
+		var child = locals[cdt][cdn];
+		if(child.drug_code){
+			frappe.call({
+				"method": "frappe.client.get",
+				args: {
+					doctype: "Item",
+					name: child.drug_code,
+				},
+				callback: function (data) {
+					frappe.model.set_value(cdt, cdn, 'drug_name',data.message.item_name);
+				}
+			});
+		}
+	},
+	dosage: function(frm, cdt, cdn){
+		frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
+		var child = locals[cdt][cdn];
+		if(child.dosage){
+			frappe.model.set_value(cdt, cdn, 'in_every', 'Day');
+			frappe.model.set_value(cdt, cdn, 'interval', 1);
+		}
+	},
+	period: function(frm, cdt, cdn){
+		frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
+	},
+	in_every: function(frm, cdt, cdn){
+		frappe.model.set_value(cdt, cdn, 'update_schedule', 1);
+		var child = locals[cdt][cdn];
+		if(child.in_every == "Hour"){
+			frappe.model.set_value(cdt, cdn, 'dosage', null);
+		}
+	}
+});
+
+
+var calculate_age = function(birth) {
+	var ageMS = Date.parse(Date()) - Date.parse(birth);
+	var age = new Date();
+	age.setTime(ageMS);
+	var years =  age.getFullYear() - 1970;
+	return  years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
+};
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/healthcare/doctype/consultation/consultation.json
similarity index 60%
copy from erpnext/subscription/doctype/subscription/subscription.json
copy to erpnext/healthcare/doctype/consultation/consultation.json
index 6cfee1e..70482cb 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/healthcare/doctype/consultation/consultation.json
@@ -1,17 +1,17 @@
 {
- "allow_copy": 0, 
+ "allow_copy": 1, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
- "allow_rename": 1, 
+ "allow_rename": 0, 
  "autoname": "naming_series:", 
- "beta": 0, 
- "creation": "2017-07-18 17:50:43.967266", 
+ "beta": 1, 
+ "creation": "2016-04-21 10:53:44.637684", 
  "custom": 0, 
+ "default_print_format": "", 
  "docstatus": 0, 
  "doctype": "DocType", 
- "document_type": "", 
+ "document_type": "Document", 
  "editable_grid": 1, 
- "engine": "InnoDB", 
  "fields": [
   {
    "allow_bulk_edit": 0, 
@@ -50,7 +50,7 @@
    "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
-   "hidden": 0, 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
@@ -60,7 +60,7 @@
    "label": "Series", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "SUB-", 
+   "options": "C-", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -79,7 +79,70 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_doctype", 
+   "depends_on": "", 
+   "fieldname": "appointment", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Appointment", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient Appointment", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "type", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Appointment Type", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -88,10 +151,10 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Reference Doctype", 
+   "label": "Patient", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "DocType", 
+   "options": "Patient", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -100,7 +163,7 @@
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
-   "search_index": 0, 
+   "search_index": 1, 
    "set_only_once": 0, 
    "unique": 0
   }, 
@@ -110,49 +173,19 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_document", 
-   "fieldtype": "Dynamic Link", 
-   "hidden": 0, 
+   "fieldname": "patient_age", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Document", 
+   "label": "Age", 
    "length": 0, 
-   "no_copy": 1, 
-   "options": "reference_doctype", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disabled", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Disabled", 
-   "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -171,18 +204,19 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "submit_on_creation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
+   "fieldname": "patient_sex", 
+   "fieldtype": "Select", 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Submit on Creation", 
+   "label": "Gender", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "\nMale\nFemale", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -201,7 +235,69 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_5", 
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Doctor", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Physician", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_6", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -230,7 +326,39 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "start_date", 
+   "fieldname": "visit_department", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Medical Department", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Today", 
+   "fieldname": "consultation_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -239,7 +367,7 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Start Date", 
+   "label": "Consultation Date", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -256,20 +384,21 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
+   "default": "", 
+   "fieldname": "consultation_time", 
+   "fieldtype": "Time", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
+   "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "End Date", 
+   "label": "Consultation Time", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -279,19 +408,19 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "next_schedule_date", 
-   "fieldtype": "Date", 
+   "fieldname": "invoice", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -299,12 +428,43 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Next Schedule Date", 
+   "label": "Invoice", 
    "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
+   "options": "Sales Invoice", 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 1, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "patient_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "remember_last_selected_value": 0, 
@@ -320,69 +480,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency_detail", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Frequency", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nDaily\nWeekly\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_12", 
-   "fieldtype": "Column Break", 
+   "fieldname": "patient_details_html", 
+   "fieldtype": "HTML", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -406,194 +505,11 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval: in_list([\"Monthly\", \"Quarterly\", \"Yearly\"], doc.frequency)", 
-   "fieldname": "repeat_on_day", 
-   "fieldtype": "Int", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Repeat on Day", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notification", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Notification", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notify_by_email", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Notify by Email", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_17", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "recipients", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Recipients", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "print_format", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Print Format", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Print Format", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
    "columns": 0, 
-   "fieldname": "section_break_16", 
+   "fieldname": "sb_symptoms", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -602,6 +518,67 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
+   "label": "Encounter Impression", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "symptoms_select", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Complaints", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Complaint", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "symptoms", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
@@ -623,25 +600,362 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
+   "default": "0", 
+   "fieldname": "symptoms_in_print", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Status", 
+   "label": "In print", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "physical_examination", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "diagnosis_select", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Diagnosis", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Diagnosis", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "diagnosis", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "depends_on": "", 
+   "fieldname": "diagnosis_in_print", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "In print", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "codification", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Medical Coding", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "codification_table", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Medical Coding", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Codification Table", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_drug_prescription", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Drug Prescription", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "drug_prescription", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Drug Prescription", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Drug Prescription", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_test_prescription", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Investigations", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_prescription", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Investigations", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Prescription", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "consultation_comment", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Review Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -667,7 +981,7 @@
    "label": "Amended From", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Subscription", 
+   "options": "Consultation", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -690,15 +1004,15 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-08-31 14:24:59.935498", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
- "name": "Subscription", 
+ "module": "Healthcare", 
+ "name": "Consultation", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0, 
+   "amend": 1, 
    "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
@@ -711,7 +1025,7 @@
    "print": 1, 
    "read": 1, 
    "report": 1, 
-   "role": "System Manager", 
+   "role": "Physician", 
    "set_user_permissions": 0, 
    "share": 1, 
    "submit": 1, 
@@ -721,11 +1035,12 @@
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "reference_document", 
- "show_name_in_global_search": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient, physician, visit_department", 
+ "show_name_in_global_search": 1, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "reference_document", 
+ "title_field": "patient", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/consultation/consultation.py b/erpnext/healthcare/doctype/consultation/consultation.py
new file mode 100755
index 0000000..b8155b9
--- /dev/null
+++ b/erpnext/healthcare/doctype/consultation/consultation.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.utils import getdate
+import json
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account
+
+class Consultation(Document):
+	def on_update(self):
+		if(self.appointment):
+			frappe.db.set_value("Patient Appointment",self.appointment,"status","Closed")
+		update_consultation_to_medical_record(self)
+
+	def after_insert(self):
+		insert_consultation_to_medical_record(self)
+
+	def on_submit(self):
+		if not self.diagnosis or not self.symptoms:
+			frappe.throw("Diagnosis and Complaints cannot be left blank")
+
+		physician = frappe.get_doc("Physician",self.physician)
+		if(frappe.session.user != physician.user_id):
+			frappe.throw(_("You don't have permission to submit"))
+
+def set_sales_invoice_fields(company, patient):
+	sales_invoice = frappe.new_doc("Sales Invoice")
+	sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
+	# patient is custom field in sales inv.
+	sales_invoice.due_date = getdate()
+	sales_invoice.is_pos = '0'
+	sales_invoice.debit_to = get_receivable_account(company)
+
+	return sales_invoice
+
+def create_sales_invoice_item_lines(item, sales_invoice):
+	sales_invoice_line = sales_invoice.append("items")
+	sales_invoice_line.item_code = item.item_code
+	sales_invoice_line.item_name =  item.item_name
+	sales_invoice_line.qty = 1.0
+	sales_invoice_line.description = item.description
+	return sales_invoice_line
+
+@frappe.whitelist()
+def create_drug_invoice(company, patient, prescriptions):
+	list_ids = json.loads(prescriptions)
+	if not (company or patient or prescriptions):
+		return False
+
+	sales_invoice = set_sales_invoice_fields(company, patient)
+	sales_invoice.update_stock = 1
+
+	for line_id in list_ids:
+		line_obj = frappe.get_doc("Drug Prescription", line_id)
+		if line_obj:
+			if(line_obj.drug_code):
+				item = frappe.get_doc("Item", line_obj.drug_code)
+				sales_invoice_line = create_sales_invoice_item_lines(item, sales_invoice)
+				sales_invoice_line.qty = line_obj.get_quantity()
+	#income_account and cost_center in itemlines - by set_missing_values()
+	sales_invoice.set_missing_values()
+	return sales_invoice.as_dict()
+
+@frappe.whitelist()
+def create_invoice(company, patient, physician, consultation_id):
+	if not consultation_id:
+		return False
+	sales_invoice = frappe.new_doc("Sales Invoice")
+	sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
+	sales_invoice.due_date = getdate()
+	sales_invoice.is_pos = '0'
+	sales_invoice.debit_to = get_receivable_account(company)
+
+	create_invoice_items(physician, sales_invoice, company)
+
+	sales_invoice.save(ignore_permissions=True)
+	frappe.db.sql(_("""update tabConsultation set invoice='{0}' where name='{1}'""").format(sales_invoice.name, consultation_id))
+	appointment = frappe.db.get_value("Consultation", consultation_id, "appointment")
+	if appointment:
+		frappe.db.set_value("Patient Appointment", appointment, "sales_invoice", sales_invoice.name)
+	return sales_invoice.name
+
+def create_invoice_items(physician, invoice, company):
+	item_line = invoice.append("items")
+	item_line.item_name = "Consulting Charges"
+	item_line.description = "Consulting Charges:  " + physician
+	item_line.qty = 1
+	item_line.uom = "Nos"
+	item_line.conversion_factor = 1
+	item_line.income_account = get_income_account(physician,company)
+	op_consulting_charge = frappe.get_value("Physician",physician,"op_consulting_charge")
+	if op_consulting_charge:
+		item_line.rate = op_consulting_charge
+		item_line.amount = op_consulting_charge
+	return invoice
+
+def insert_consultation_to_medical_record(doc):
+	subject = set_subject_field(doc)
+	medical_record = frappe.new_doc("Patient Medical Record")
+	medical_record.patient = doc.patient
+	medical_record.subject = subject
+	medical_record.status = "Open"
+	medical_record.communication_date = doc.consultation_date
+	medical_record.reference_doctype = "Consultation"
+	medical_record.reference_name = doc.name
+	medical_record.reference_owner = doc.owner
+	medical_record.save(ignore_permissions=True)
+
+def update_consultation_to_medical_record(consultation):
+	medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(consultation.name))
+	if(medical_record_id[0][0]):
+		subject = set_subject_field(consultation)
+		frappe.db.set_value("Patient Medical Record",medical_record_id[0][0],"subject",subject)
+
+def set_subject_field(consultation):
+	subject = "No Diagnosis "
+	if(consultation.diagnosis):
+		subject = "Diagnosis: \n"+ str(consultation.diagnosis)+". "
+	if(consultation.drug_prescription):
+		subject +="\nDrug(s) Prescribed. "
+	if(consultation.test_prescription):
+		subject += " Test(s) Prescribed."
+
+	return subject
diff --git a/erpnext/healthcare/doctype/consultation/consultation_dashboard.py b/erpnext/healthcare/doctype/consultation/consultation_dashboard.py
new file mode 100644
index 0000000..6170891
--- /dev/null
+++ b/erpnext/healthcare/doctype/consultation/consultation_dashboard.py
@@ -0,0 +1,15 @@
+from frappe import _
+
+def get_data():
+	return {
+		'fieldname': 'consultation',
+		'non_standard_fieldnames': {
+			'Patient Medical Record': 'reference_name'
+		},
+		'transactions': [
+			{
+				'label': _('Records'),
+				'items': ['Vital Signs', 'Patient Medical Record']
+			},
+		]
+	}
diff --git a/erpnext/healthcare/doctype/consultation/consultation_list.js b/erpnext/healthcare/doctype/consultation/consultation_list.js
new file mode 100755
index 0000000..ea3906d
--- /dev/null
+++ b/erpnext/healthcare/doctype/consultation/consultation_list.js
@@ -0,0 +1,7 @@
+/*
+(c) ESS 2015-16
+*/
+frappe.listview_settings['Consultation'] = {
+	filters:[["docstatus","!=","1"]]
+};
+
diff --git a/erpnext/healthcare/doctype/consultation/test_consultation.js b/erpnext/healthcare/doctype/consultation/test_consultation.js
new file mode 100644
index 0000000..803e73c
--- /dev/null
+++ b/erpnext/healthcare/doctype/consultation/test_consultation.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Consultation", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Consultation
+		() => frappe.tests.make('Consultation', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/consultation/test_consultation.py b/erpnext/healthcare/doctype/consultation/test_consultation.py
new file mode 100644
index 0000000..24dc011
--- /dev/null
+++ b/erpnext/healthcare/doctype/consultation/test_consultation.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Consultation')
+
+class TestConsultation(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/diagnosis/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/diagnosis/__init__.py
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.js b/erpnext/healthcare/doctype/diagnosis/diagnosis.js
new file mode 100644
index 0000000..fb2557f
--- /dev/null
+++ b/erpnext/healthcare/doctype/diagnosis/diagnosis.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Diagnosis', {
+});
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.json b/erpnext/healthcare/doctype/diagnosis/diagnosis.json
new file mode 100644
index 0000000..b14ce94
--- /dev/null
+++ b/erpnext/healthcare/doctype/diagnosis/diagnosis.json
@@ -0,0 +1,116 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:diagnosis", 
+ "beta": 1, 
+ "creation": "2017-02-15 12:23:59.341108", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "diagnosis", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Diagnosis", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:40:09.731904", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Diagnosis", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "diagnosis", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "diagnosis", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.py b/erpnext/healthcare/doctype/diagnosis/diagnosis.py
new file mode 100644
index 0000000..f56e790
--- /dev/null
+++ b/erpnext/healthcare/doctype/diagnosis/diagnosis.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class Diagnosis(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/diagnosis/test_diagnosis.js b/erpnext/healthcare/doctype/diagnosis/test_diagnosis.js
new file mode 100644
index 0000000..cacfef5
--- /dev/null
+++ b/erpnext/healthcare/doctype/diagnosis/test_diagnosis.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Diagnosis", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Diagnosis
+		() => frappe.tests.make('Diagnosis', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/diagnosis/test_diagnosis.py b/erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
new file mode 100644
index 0000000..c79164d
--- /dev/null
+++ b/erpnext/healthcare/doctype/diagnosis/test_diagnosis.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+# test_records = frappe.get_test_records('Diagnosis')
+
+class TestDiagnosis(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/dosage_form/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/dosage_form/__init__.py
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.js b/erpnext/healthcare/doctype/dosage_form/dosage_form.js
new file mode 100644
index 0000000..60e9696
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_form/dosage_form.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Dosage Form', {
+});
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.json b/erpnext/healthcare/doctype/dosage_form/dosage_form.json
new file mode 100644
index 0000000..1de0e93
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_form/dosage_form.json
@@ -0,0 +1,114 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:dosage_form", 
+ "beta": 1, 
+ "creation": "2017-04-08 12:04:33.987972", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "dosage_form", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Dosage Form", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:40:19.973532", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Dosage Form", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.py b/erpnext/healthcare/doctype/dosage_form/dosage_form.py
new file mode 100644
index 0000000..046af08
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_form/dosage_form.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class DosageForm(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/dosage_form/test_dosage_form.js b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.js
new file mode 100644
index 0000000..ba54ab1
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Dosage Form", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Dosage Form
+		() => frappe.tests.make('Dosage Form', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
new file mode 100644
index 0000000..81cfcf6
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+class TestDosageForm(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/dosage_strength/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/dosage_strength/__init__.py
diff --git a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.json b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
new file mode 100644
index 0000000..da4f1a7
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.json
@@ -0,0 +1,102 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-02-14 15:40:14.385707", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "strength", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Strength", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "strength_time", 
+   "fieldtype": "Time", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Time", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:11:59.874645", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Dosage Strength", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
new file mode 100644
index 0000000..e36a016
--- /dev/null
+++ b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class DosageStrength(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/drug_prescription/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/drug_prescription/__init__.py
diff --git a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.json b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.json
new file mode 100644
index 0000000..c96df22
--- /dev/null
+++ b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.json
@@ -0,0 +1,381 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-09-16 16:41:45.533374", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "drug_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Drug Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "drug_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Description/Strength", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "dosage", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Dosage", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Prescription Dosage", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "period", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Period", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Prescription Duration", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "dosage_form", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Dosage Form", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Dosage Form", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_7", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "comment", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Comment", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "use_interval", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Dosage by time interval", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "use_interval", 
+   "fieldname": "interval", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Interval", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "use_interval", 
+   "fieldname": "in_every", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Interval UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nHour\nDay", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "update_schedule", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Update Schedule", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:59:48.222282", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Drug Prescription", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
new file mode 100755
index 0000000..0d99198
--- /dev/null
+++ b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class DrugPrescription(Document):
+	def get_quantity(self):
+		quantity = 0
+		dosage = None
+		period = None
+
+		if(self.dosage):
+			dosage = frappe.get_doc("Prescription Dosage",self.dosage)
+			for item in dosage.dosage_strength:
+				quantity += item.strength
+			if(self.period and self.interval):
+				period = frappe.get_doc("Prescription Duration",self.period)
+				if(self.interval < period.get_days()):
+					quantity = quantity*(period.get_days()/self.interval)
+
+		elif(self.interval and self.in_every and self.period):
+			period = frappe.get_doc("Prescription Duration",self.period)
+			interval_in = self.in_every
+			if(interval_in == 'Day' and (self.interval < period.get_days())):
+				quantity = period.get_days()/self.interval
+			elif(interval_in == 'Hour' and (self.interval < period.get_hours())):
+				quantity = period.get_hours()/self.interval
+		if quantity > 0:
+			return quantity
+		else:
+			return 1
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/fee_validity/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/fee_validity/__init__.py
diff --git a/erpnext/healthcare/doctype/fee_validity/fee_validity.js b/erpnext/healthcare/doctype/fee_validity/fee_validity.js
new file mode 100644
index 0000000..7ea2213
--- /dev/null
+++ b/erpnext/healthcare/doctype/fee_validity/fee_validity.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Fee Validity', {
+});
diff --git a/erpnext/healthcare/doctype/fee_validity/fee_validity.json b/erpnext/healthcare/doctype/fee_validity/fee_validity.json
new file mode 100644
index 0000000..4bbd20b
--- /dev/null
+++ b/erpnext/healthcare/doctype/fee_validity/fee_validity.json
@@ -0,0 +1,248 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-01-05 10:56:29.564806", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Physician", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Physician", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "max_visit", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Max number of visit", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "visited", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Visited yet", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "valid_till", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Valid till", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "ref_invoice", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reference Inv", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sales Invoice", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:36:52.108407", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Fee Validity", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "physician,patient", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "physician", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/fee_validity/fee_validity.py b/erpnext/healthcare/doctype/fee_validity/fee_validity.py
new file mode 100644
index 0000000..53a1741
--- /dev/null
+++ b/erpnext/healthcare/doctype/fee_validity/fee_validity.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class FeeValidity(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.js b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.js
new file mode 100644
index 0000000..0ebb974
--- /dev/null
+++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Fee Validity", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Fee Validity
+		() => frappe.tests.make('Fee Validity', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
new file mode 100644
index 0000000..2345872
--- /dev/null
+++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+from erpnext.healthcare.doctype.patient_appointment.patient_appointment import create_invoice
+from frappe.utils.make_random import get_random
+from frappe.utils import nowdate, add_days
+# test_records = frappe.get_test_records('Fee Validity')
+
+class TestFeeValidity(unittest.TestCase):
+	def test_fee_validity(self):
+		patient = get_random("Patient")
+		physician = get_random("Physician")
+
+		if not patient:
+			patient = frappe.new_doc("Patient")
+			patient.patient_name = "Test Patient"
+			patient.sex = "Male"
+			patient.save(ignore_permissions = True)
+			patient = patient.name
+
+		if not physician:
+			physician = frappe.new_doc("Physician")
+			physician.first_name= "Amit Jain"
+			physician.save(ignore_permissions = True)
+			physician = physician.name
+
+		frappe.db.set_value("Healthcare Settings", None, "max_visit", 2)
+		frappe.db.set_value("Healthcare Settings", None, "valid_days", 7)
+
+		appointment = create_appointment(patient, physician, nowdate())
+		invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
+		self.assertEqual(invoice, None)
+		create_invoice(frappe.defaults.get_global_default("company"), physician, patient, appointment.name, appointment.appointment_date)
+		appointment = create_appointment(patient, physician, add_days(nowdate(), 4))
+		invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
+		self.assertTrue(invoice)
+		appointment = create_appointment(patient, physician, add_days(nowdate(), 5))
+		invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
+		self.assertEqual(invoice, None)
+		appointment = create_appointment(patient, physician, add_days(nowdate(), 10))
+		invoice = frappe.db.get_value("Patient Appointment", appointment.name, "sales_invoice")
+		self.assertEqual(invoice, None)
+
+def create_appointment(patient, physician, appointment_date):
+	appointment = frappe.new_doc("Patient Appointment")
+	appointment.patient = patient
+	appointment.physician = physician
+	appointment.appointment_date = appointment_date
+	appointment.save(ignore_permissions = True)
+	return appointment
diff --git a/erpnext/healthcare/doctype/healthcare.py b/erpnext/healthcare/doctype/healthcare.py
new file mode 100644
index 0000000..6fd2015
--- /dev/null
+++ b/erpnext/healthcare/doctype/healthcare.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+def get_data():
+
+	return []
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/healthcare_settings/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/healthcare_settings/__init__.py
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
new file mode 100644
index 0000000..75b0584
--- /dev/null
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
@@ -0,0 +1,25 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Healthcare Settings', {
+	setup: function(frm) {
+		frm.set_query('account', 'receivable_account', function(doc, cdt, cdn) {
+			var d  = locals[cdt][cdn];
+			return {
+				filters: {
+					'account_type': 'Receivable',
+					'company': d.company,
+				}
+			};
+		});
+		frm.set_query('account', 'income_account', function(doc, cdt, cdn) {
+			var d  = locals[cdt][cdn];
+			return {
+				filters: {
+					'root_type': 'Income',
+					'company': d.company,
+				}
+			};
+		});
+	}
+});
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
new file mode 100644
index 0000000..8681641
--- /dev/null
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
@@ -0,0 +1,1073 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-05-09 11:26:22.337760", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_op_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Out Patient Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_master_name", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Name By", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient Name\nNaming Series", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "description": "If checked, a customer will be created, mapped to Patient.\nPatient Invoices will be created against this Customer. You can also select existing Customer while creating Patient.", 
+   "fieldname": "manage_customer", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Manage Customer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "default_medical_code_standard", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Medical Code Standard", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Medical Code Standard", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_9", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "collect_registration_fee", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Collect Fee for Patient Registration", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "collect_registration_fee", 
+   "fieldname": "registration_fee", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Registration Fee", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "max_visit", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Consultations in valid days", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "valid_days", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Valid number of days", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "out_patient_sms_alerts", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Out Patient SMS Alerts", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reg_sms", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Registration", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Hello {{doc.patient}}, Thank you for registering with  {{doc.company}}. Your ID is {{doc.id}} . Please note this ID for future reference. \nThank You, Get well soon!", 
+   "depends_on": "reg_sms", 
+   "fieldname": "reg_msg", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Registration Message", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "app_con", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Appointment Confirmation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Hello {{doc.patient}}, You have scheduled an appointment with {{doc.physician}} by {{doc.start_dt}} at  {{doc.company}}.\nThank you, Good day!", 
+   "depends_on": "app_con", 
+   "fieldname": "app_con_msg", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Confirmation Message", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "app_con", 
+   "description": "Do not confirm if appointment is created for the same day", 
+   "fieldname": "no_con", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Avoid Confirmation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_16", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "app_rem", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Appointment Reminder", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Hello {{doc.patient}}, You have an appointment with {{doc.physician}} by {{doc.appointment_time}} at  {{doc.company}}.\nThank you, Good day!\n", 
+   "depends_on": "app_rem", 
+   "fieldname": "app_rem_msg", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reminder Message", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "app_rem", 
+   "fieldname": "rem_before", 
+   "fieldtype": "Time", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Remind Before", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "description": "Default income accounts to be used if not set in Physician to book Consultation charges.", 
+   "fieldname": "sb_in_ac", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "income_account", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Party Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "description": "Default receivable accounts to be used if not set in Patient to book Consultation charges.", 
+   "fieldname": "sb_r_ac", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Receivable Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "receivable_account", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Receivable Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Party Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "sb_lab_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Laboratory Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Create documents for sample collection", 
+   "fieldname": "require_sample_collection", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Manage Sample Collection", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "require_test_result_approval", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Require Lab Test Approval", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_34", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "fieldname": "employee_name_and_designation_in_print", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Employee name and designation in print", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.employee_name_and_designation_in_print == '0'\n", 
+   "fieldname": "custom_signature_in_print", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Custom Signature in Print", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "laboratory_sms_alerts", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Laboratory SMS Alerts", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Hello {{doc.patient}}, Your {{doc.test_name}} result is ready with {{doc.company }}. \nThank You, Good day!", 
+   "fieldname": "sms_printed", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Result Printed", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_28", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Hello {{doc.patient}}, Your {{doc.test_name}} result has been emailed to {{doc.email}}. \n{{doc.company }}. \nThank You, Good day!", 
+   "fieldname": "sms_emailed", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Result Emailed", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 1, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:25:48.193218", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Healthcare Settings", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
new file mode 100644
index 0000000..7206e4b
--- /dev/null
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+from frappe.core.doctype.sms_settings.sms_settings import send_sms
+import json
+
+class HealthcareSettings(Document):
+	def validate(self):
+		for key in ["collect_registration_fee","manage_customer","patient_master_name",
+		"require_test_result_approval","require_sample_collection", "default_medical_code_standard"]:
+			frappe.db.set_default(key, self.get(key, ""))
+		if(self.collect_registration_fee):
+			if self.registration_fee <= 0 :
+				frappe.throw("Registration fee can not be Zero")
+
+@frappe.whitelist()
+def get_sms_text(doc):
+	sms_text = {}
+	doc = frappe.get_doc("Lab Test",doc)
+	#doc = json.loads(doc)
+	context = {"doc": doc, "alert": doc, "comments": None}
+	emailed = frappe.db.get_value("Healthcare Settings", None, "sms_emailed")
+	sms_text['emailed'] = frappe.render_template(emailed, context)
+ 	printed = frappe.db.get_value("Healthcare Settings", None, "sms_printed")
+	sms_text['printed'] = frappe.render_template(printed, context)
+	return sms_text
+
+def send_registration_sms(doc):
+	if (frappe.db.get_value("Healthcare Settings", None, "reg_sms")=='1'):
+		if doc.mobile:
+			context = {"doc": doc, "alert": doc, "comments": None}
+			if doc.get("_comments"):
+				context["comments"] = json.loads(doc.get("_comments"))
+			messages = frappe.db.get_value("Healthcare Settings", None, "reg_msg")
+			messages = frappe.render_template(messages, context)
+			number = [doc.mobile]
+			send_sms(number,messages)
+		else:
+			frappe.msgprint(doc.name + " Has no mobile number to send registration SMS", alert=True)
+
+
+def get_receivable_account(company):
+	receivable_account = get_account(None, "receivable_account", "Healthcare Settings", company)
+	if receivable_account:
+		return receivable_account
+	return frappe.db.get_value("Company", company, "default_receivable_account")
+
+def get_income_account(physician, company):
+	if(physician):
+		income_account = get_account("Physician", None, physician, company)
+		if income_account:
+			return income_account
+	income_account = get_account(None, "income_account", "Healthcare Settings", company)
+	if income_account:
+		return income_account
+	return frappe.db.get_value("Company", company, "default_income_account")
+
+def get_account(parent_type, parent_field, parent, company):
+	if(parent_type):
+		return frappe.db.get_value("Party Account",
+			{"parenttype": parent_type, "parent": parent, "company": company}, "account")
+	if(parent_field):
+		return frappe.db.get_value("Party Account",
+			{"parentfield": parent_field, "parent": parent, "company": company}, "account")
diff --git a/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.js b/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.js
new file mode 100644
index 0000000..ca10925
--- /dev/null
+++ b/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Healthcare Settings", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Healthcare Settings
+		() => frappe.tests.make('Healthcare Settings', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/lab_prescription/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/lab_prescription/__init__.py
diff --git a/erpnext/healthcare/doctype/lab_prescription/lab_prescription.json b/erpnext/healthcare/doctype/lab_prescription/lab_prescription.json
new file mode 100644
index 0000000..2d1a8d6
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_prescription/lab_prescription.json
@@ -0,0 +1,223 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-09-16 16:53:06.882970", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 1, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Test Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Test", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "test_code.test_name", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "invoice", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Invoice", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sales Invoice", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_4", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_comment", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Comments", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_created", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Test Created", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:47:22.789095", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Lab Prescription", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py b/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py
new file mode 100644
index 0000000..b788a0d
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class LabPrescription(Document):
+	pass
diff --git a/erpnext/subscription/__init__.py b/erpnext/healthcare/doctype/lab_test/__init__.py
similarity index 100%
copy from erpnext/subscription/__init__.py
copy to erpnext/healthcare/doctype/lab_test/__init__.py
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.js b/erpnext/healthcare/doctype/lab_test/lab_test.js
new file mode 100644
index 0000000..2a453cd
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.js
@@ -0,0 +1,323 @@
+// Copyright (c) 2016, ESS and contributors
+// For license information, please see license.txt
+
+cur_frm.cscript.custom_refresh = function(doc) {
+	cur_frm.toggle_display("sb_sensitivity", doc.sensitivity_toggle=="1");
+	cur_frm.toggle_display("sb_special", doc.special_toggle=="1");
+	cur_frm.toggle_display("sb_normal", doc.normal_toggle=="1");
+};
+
+frappe.ui.form.on('Lab Test', {
+	setup: function(frm) {
+		frm.get_field('normal_test_items').grid.editable_fields = [
+			{fieldname: 'test_name', columns: 3},
+			{fieldname: 'test_event', columns: 2},
+			{fieldname: 'result_value', columns: 2},
+			{fieldname: 'test_uom', columns: 1},
+			{fieldname: 'normal_range', columns: 2}
+		];
+		frm.get_field('special_test_items').grid.editable_fields = [
+			{fieldname: 'test_particulars', columns: 3},
+			{fieldname: 'result_value', columns: 7}
+		];
+	},
+	refresh :  function(frm){
+		refresh_field('normal_test_items');
+		refresh_field('special_test_items');
+		if(!frm.doc.__islocal && !frm.doc.invoice && frappe.user.has_role("Accounts User")){
+			frm.add_custom_button(__('Make Invoice'), function() {
+				make_invoice(frm);
+			});
+		}
+		if(frm.doc.__islocal){
+			frm.add_custom_button(__('Get from Consultation'), function () {
+				get_lab_test_prescribed(frm);
+			});
+		}
+		if(frm.doc.docstatus==1	&&	frm.doc.status!='Approved'	&&	frm.doc.status!='Rejected'	&&	frappe.defaults.get_default("require_test_result_approval")	&&	frappe.user.has_role("LabTest Approver")){
+			frm.add_custom_button(__('Approve'), function() {
+				status_update(1,frm);
+			});
+			frm.add_custom_button(__('Reject'), function() {
+				status_update(0,frm);
+			});
+		}
+		if(frm.doc.docstatus==1 && frm.doc.sms_sent==0){
+			frm.add_custom_button(__('Send SMS'), function() {
+				frappe.call({
+					method: "erpnext.healthcare.doctype.healthcare_settings.healthcare_settings.get_sms_text",
+					args:{doc: frm.doc.name},
+					callback: function(r) {
+						if(!r.exc) {
+							var emailed = r.message.emailed;
+							var printed = r.message.printed;
+							make_dialog(frm, emailed, printed);
+						}
+					}
+				});
+			});
+		}
+
+	},
+	onload: function (frm) {
+		frm.add_fetch("physician", "department", "department");
+		if(frm.doc.employee){
+			frappe.call({
+				method: "frappe.client.get",
+				args:{
+					doctype: "Employee",
+					name: frm.doc.employee
+				},
+				callback: function(arg){
+					frappe.model.set_value(frm.doctype,frm.docname,"employee_name", arg.message.employee_name);
+					frappe.model.set_value(frm.doctype,frm.docname,"employee_designation", arg.message.designation);
+				}
+			});
+		}
+	}
+});
+
+frappe.ui.form.on("Lab Test", "patient", function(frm) {
+	if(frm.doc.patient){
+		frappe.call({
+			"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
+			args: {
+				patient: frm.doc.patient
+			},
+			callback: function (data) {
+				var age = null;
+				if(data.message.dob){
+					age = calculate_age(data.message.dob);
+				}
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_sex", data.message.sex);
+				frappe.model.set_value(frm.doctype,frm.docname, "email", data.message.email);
+				frappe.model.set_value(frm.doctype,frm.docname, "mobile", data.message.mobile);
+				frappe.model.set_value(frm.doctype,frm.docname, "report_preference", data.message.report_preference);
+			}
+		});
+	}
+});
+
+frappe.ui.form.on('Normal Test Items', {
+	normal_test_items_remove: function() {
+		frappe.msgprint("Not permitted, configure Lab Test Template as required");
+		cur_frm.reload_doc();
+	}
+});
+
+frappe.ui.form.on('Special Test Items', {
+	special_test_items_remove: function() {
+		frappe.msgprint("Not permitted, configure Lab Test Template as required");
+		cur_frm.reload_doc();
+	}
+});
+
+var status_update = function(approve,frm){
+	var doc = frm.doc;
+	var status = null;
+	if(approve == 1){
+		status = "Approved";
+	}
+	else {
+		status = "Rejected";
+	}
+	frappe.call({
+		method: "erpnext.healthcare.doctype.lab_test.lab_test.update_status",
+		args: {status: status, name: doc.name},
+		callback: function(){
+			cur_frm.reload_doc();
+		}
+	});
+};
+
+var get_lab_test_prescribed = function(frm){
+	if(frm.doc.patient){
+		frappe.call({
+			method:	"erpnext.healthcare.doctype.lab_test.lab_test.get_lab_test_prescribed",
+			args:	{patient: frm.doc.patient},
+			callback: function(r){
+				show_lab_tests(frm, r.message);
+			}
+		});
+	}
+	else{
+		frappe.msgprint("Please select Patient to get Lab Tests");
+	}
+};
+
+var show_lab_tests = function(frm, result){
+	var d = new frappe.ui.Dialog({
+		title: __("Lab Test Prescriptions"),
+		fields: [
+			{
+				fieldtype: "HTML", fieldname: "lab_test"
+			}
+		]
+	});
+	var html_field = d.fields_dict.lab_test.$wrapper;
+	html_field.empty();
+	$.each(result, function(x, y){
+		var row = $(repl('<div class="col-xs-12" style="padding-top:12px; text-align:center;" >\
+		<div class="col-xs-2"> %(lab_test)s </div>\
+		<div class="col-xs-2"> %(consultation)s </div>\
+		<div class="col-xs-3"> %(physician)s </div>\
+		<div class="col-xs-3"> %(date)s </div>\
+		<div class="col-xs-1">\
+		<a data-name="%(name)s" data-lab-test="%(lab_test)s"\
+		data-consultation="%(consultation)s" data-physician="%(physician)s"\
+		data-invoice="%(invoice)s" href="#"><button class="btn btn-default btn-xs">Get Lab Test\
+		</button></a></div></div>', {name:y[0], lab_test: y[1], consultation:y[2], invoice:y[3], physician:y[4], date:y[5]})).appendTo(html_field);
+		row.find("a").click(function() {
+			frm.doc.template = $(this).attr("data-lab-test");
+			frm.doc.prescription = $(this).attr("data-name");
+			frm.doc.physician = $(this).attr("data-physician");
+			frm.set_df_property("template", "read_only", 1);
+			frm.set_df_property("patient", "read_only", 1);
+			frm.set_df_property("physician", "read_only", 1);
+			if($(this).attr("data-invoice") != 'null'){
+				frm.doc.invoice = $(this).attr("data-invoice");
+				refresh_field("invoice");
+			}else {
+				frm.doc.invoice = "";
+				refresh_field("invoice");
+			}
+
+			refresh_field("template");
+			d.hide();
+			return false;
+		});
+	});
+	if(!result){
+		var msg = "There are no Lab Test prescribed for "+frm.doc.patient;
+		$(repl('<div class="col-xs-12" style="padding-top:20px;" >%(msg)s</div></div>', {msg: msg})).appendTo(html_field);
+	}
+	d.show();
+};
+
+var make_invoice = function(frm){
+	var doc = frm.doc;
+	frappe.call({
+		method: "erpnext.healthcare.doctype.lab_test.lab_test.create_invoice",
+		args: {company:doc.company, patient:doc.patient, lab_tests: [doc.name], prescriptions:[]},
+		callback: function(r){
+			if(!r.exc){
+				if(r.message){
+					/*	frappe.show_alert(__('Sales Invoice {0} created',
+					['<a href="#Form/Sales Invoice/'+r.message+'">' + r.message+ '</a>']));	*/
+					frappe.set_route("Form", "Sales Invoice", r.message);
+				}
+				cur_frm.reload_doc();
+			}
+		}
+	});
+};
+
+cur_frm.cscript.custom_before_submit =  function(doc) {
+	if(doc.normal_test_items){
+		for(let result in doc.normal_test_items){
+			if(!doc.normal_test_items[result].result_value	&&	doc.normal_test_items[result].require_result_value == 1){
+				frappe.msgprint("Please input all required Result Value(s)");
+				throw("Error");
+			}
+		}
+	}
+	if(doc.special_test_items){
+		for(let result in doc.special_test_items){
+			if(!doc.special_test_items[result].result_value	&&	doc.special_test_items[result].require_result_value == 1){
+				frappe.msgprint("Please input all required Result Value(s)");
+				throw("Error");
+			}
+		}
+	}
+};
+
+var make_dialog = function(frm, emailed, printed) {
+	var number = frm.doc.mobile;
+
+	var dialog = new frappe.ui.Dialog({
+		title: 'Send SMS',
+		width: 400,
+		fields: [
+			{fieldname:'sms_type', fieldtype:'Select', label:'Type', options:
+			['Emailed','Printed']},
+			{fieldname:'number', fieldtype:'Data', label:'Mobile Number', reqd:1},
+			{fieldname:'messages_label', fieldtype:'HTML'},
+			{fieldname:'messages', fieldtype:'HTML', reqd:1}
+		],
+		primary_action_label: __("Send"),
+		primary_action : function(){
+			var values = dialog.fields_dict;
+			if(!values){
+				return;
+			}
+			send_sms(values,frm);
+			dialog.hide();
+		}
+	});
+	if(frm.doc.report_preference == "Email"){
+		dialog.set_values({
+			'sms_type': "Emailed",
+			'number': number
+		});
+		dialog.fields_dict.messages_label.html("Message".bold());
+		dialog.fields_dict.messages.html(emailed);
+	}else{
+		dialog.set_values({
+			'sms_type': "Printed",
+			'number': number
+		});
+		dialog.fields_dict.messages_label.html("Message".bold());
+		dialog.fields_dict.messages.html(printed);
+	}
+	var fd = dialog.fields_dict;
+	$(fd.sms_type.input).change(function(){
+		if(dialog.get_value('sms_type') == 'Emailed'){
+			dialog.set_values({
+				'number': number
+			});
+			fd.messages_label.html("Message".bold());
+			fd.messages.html(emailed);
+		}else{
+			dialog.set_values({
+				'number': number
+			});
+			fd.messages_label.html("Message".bold());
+			fd.messages.html(printed);
+		}
+	});
+	dialog.show();
+};
+
+var send_sms = function(v,frm){
+	var doc = frm.doc;
+	var number = v.number.last_value;
+	var messages = v.messages.wrapper.innerText;
+	frappe.call({
+		method: "frappe.core.doctype.sms_settings.sms_settings.send_sms",
+		args: {
+			receiver_list: [number],
+			msg: messages
+		},
+		callback: function(r) {
+			if(r.exc) {frappe.msgprint(r.exc); return; }
+			else{
+				frappe.call({
+					method: "erpnext.healthcare.doctype.lab_test.lab_test.update_lab_test_print_sms_email_status",
+					args: {print_sms_email: "sms_sent", name: doc.name},
+					callback: function(){
+						cur_frm.reload_doc();
+					}
+				});
+			}
+		}
+	});
+};
+
+var calculate_age = function(birth) {
+	var	ageMS = Date.parse(Date()) - Date.parse(birth);
+	var	age = new Date();
+	age.setTime(ageMS);
+	var	years =  age.getFullYear() - 1970;
+	return  years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
+};
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.json b/erpnext/healthcare/doctype/lab_test/lab_test.json
new file mode 100644
index 0000000..93e40cc
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.json
@@ -0,0 +1,1470 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "autoname": "naming_series:", 
+ "beta": 1, 
+ "creation": "2016-03-29 17:34:47.509094", 
+ "custom": 0, 
+ "default_print_format": "", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Series", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "LP-", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "invoice", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Invoice", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sales Invoice", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Patient", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_name", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "patient.patient_name", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_age", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Age", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_sex", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Gender", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nMale\nFemale", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Doctor", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Physician", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "email", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Email", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "mobile", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Mobile", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "c_b", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "department", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Medical Department", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Draft\nCompleted\nApproved\nRejected\nCancelled", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "submitted_date", 
+   "fieldtype": "Datetime", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Submitted Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "approved_date", 
+   "fieldtype": "Datetime", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Approved Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Sample ID", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sample Collection", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "fieldname": "result_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Result Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "employee", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Lab Technician", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Employee", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "employee_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Technician Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "employee.employee_name", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "employee_designation", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Designation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "employee.designation", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "user", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "User", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "report_preference", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Report Preference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_first", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Test Name", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_26", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "template", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Test Template", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_group", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Test Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item Group", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_normal", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "normal_test_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Normal Test Items", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_special", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "special_test_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Special Test Items", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_sensitivity", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sensitivity_test_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sensitivity Test Items", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_comments", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_comment", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Comments", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "sb_customresult", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Custom Result", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "custom_result", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Custom Result", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "email_sent", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "sms_sent", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "printed", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "normal_toggle", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "special_toggle", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "sensitivity_toggle", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Lab Test", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "prescription", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Prescription", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Prescription", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "", 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:52:14.180774", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Lab Test", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "LabTest Approver", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient,invoice,physician,test_name,sample", 
+ "show_name_in_global_search": 1, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "patient", 
+ "track_changes": 1, 
+ "track_seen": 1
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py
new file mode 100644
index 0000000..0daf9cb
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.py
@@ -0,0 +1,295 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+import json
+from frappe.utils import getdate
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account
+from frappe import _
+
+class LabTest(Document):
+	def on_submit(self):
+		frappe.db.set_value(self.doctype,self.name,"submitted_date", getdate())
+		insert_lab_test_to_medical_record(self)
+		frappe.db.set_value("Lab Test", self.name, "status", "Completed")
+
+	def on_cancel(self):
+		delete_lab_test_from_medical_record(self)
+		frappe.db.set_value("Lab Test", self.name, "status", "Cancelled")
+		self.reload()
+
+	def on_update(self):
+		if(self.sensitivity_test_items):
+			sensitivity = sorted(self.sensitivity_test_items, key=lambda x: x.antibiotic_sensitivity)
+			for i, item in enumerate(sensitivity):
+				item.idx = i+1
+			self.sensitivity_test_items = sensitivity
+
+	def after_insert(self):
+		if(self.prescription):
+			frappe.db.set_value("Lab Prescription", self.prescription, "test_created", 1)
+		if not self.test_name and self.template:
+			self.load_test_from_template()
+			self.reload()
+
+	def load_test_from_template(self):
+		lab_test = self
+		create_test_from_template(lab_test)
+		self.reload()
+
+def create_test_from_template(lab_test):
+	template = frappe.get_doc("Lab Test Template", lab_test.template)
+	patient = frappe.get_doc("Patient", lab_test.patient)
+
+	lab_test.test_name = template.test_name
+	lab_test.result_date = getdate()
+	lab_test.department = template.department
+	lab_test.test_group = template.test_group
+
+	lab_test = create_sample_collection(lab_test, template, patient, None)
+	lab_test = load_result_format(lab_test, template, None, None)
+
+@frappe.whitelist()
+def update_status(status, name):
+	frappe.db.sql("""update `tabLab Test` set status=%s, approved_date=%s where name = %s""", (status, getdate(), name))
+
+@frappe.whitelist()
+def update_lab_test_print_sms_email_status(print_sms_email, name):
+	frappe.db.set_value("Lab Test",name,print_sms_email,1)
+
+def create_lab_test_doc(invoice, consultation, patient, template):
+	#create Test Result for template, copy vals from Invoice
+	lab_test = frappe.new_doc("Lab Test")
+	if(invoice):
+		lab_test.invoice = invoice
+	if(consultation):
+		lab_test.physician = consultation.physician
+	lab_test.patient = patient.name
+	lab_test.patient_age = patient.get_age()
+	lab_test.patient_sex = patient.sex
+	lab_test.email = patient.email
+	lab_test.mobile = patient.mobile
+	lab_test.department = template.department
+	lab_test.test_name = template.test_name
+	lab_test.template = template.name
+	lab_test.test_group = template.test_group
+	lab_test.result_date = getdate()
+	lab_test.report_preference = patient.report_preference
+	return lab_test
+
+def create_normals(template, lab_test):
+	lab_test.normal_toggle = "1"
+	normal = lab_test.append("normal_test_items")
+	normal.test_name = template.test_name
+	normal.test_uom = template.test_uom
+	normal.normal_range = template.test_normal_range
+	normal.require_result_value = 1
+	normal.template = template.name
+
+def create_compounds(template, lab_test, is_group):
+	lab_test.normal_toggle = "1"
+	for normal_test_template in template.normal_test_templates:
+		normal = lab_test.append("normal_test_items")
+		if is_group:
+			normal.test_event = normal_test_template.test_event
+		else:
+			normal.test_name = normal_test_template.test_event
+
+		normal.test_uom = normal_test_template.test_uom
+		normal.normal_range = normal_test_template.normal_range
+		normal.require_result_value = 1
+		normal.template = template.name
+
+def create_specials(template, lab_test):
+	lab_test.special_toggle = "1"
+	if(template.sensitivity):
+		lab_test.sensitivity_toggle = "1"
+	for special_test_template in template.special_test_template:
+		special = lab_test.append("special_test_items")
+		special.test_particulars = special_test_template.particulars
+		special.require_result_value = 1
+		special.template = template.name
+
+def create_sample_doc(template, patient, invoice):
+	if(template.sample):
+		sample_exist = frappe.db.exists({
+			"doctype": "Sample Collection",
+			"patient": patient.name,
+			"docstatus": 0,
+			"sample": template.sample})
+		if sample_exist :
+			#Update Sample Collection by adding quantity
+			sample_collection = frappe.get_doc("Sample Collection",sample_exist[0][0])
+			quantity = int(sample_collection.sample_quantity)+int(template.sample_quantity)
+			if(template.sample_collection_details):
+				sample_collection_details = sample_collection.sample_collection_details+"\n==============\n"+"Test :"+template.test_name+"\n"+"Collection Detials:\n\t"+template.sample_collection_details
+				frappe.db.set_value("Sample Collection", sample_collection.name, "sample_collection_details",sample_collection_details)
+			frappe.db.set_value("Sample Collection", sample_collection.name, "sample_quantity",quantity)
+
+		else:
+			#create Sample Collection for template, copy vals from Invoice
+			sample_collection = frappe.new_doc("Sample Collection")
+			if(invoice):
+				sample_collection.invoice = invoice
+			sample_collection.patient = patient.name
+			sample_collection.patient_age = patient.get_age()
+			sample_collection.patient_sex = patient.sex
+			sample_collection.sample = template.sample
+			sample_collection.sample_uom = template.sample_uom
+			sample_collection.sample_quantity = template.sample_quantity
+			if(template.sample_collection_details):
+				sample_collection.sample_collection_details = "Test :"+template.test_name+"\n"+"Collection Detials:\n\t"+template.sample_collection_details
+			sample_collection.save(ignore_permissions=True)
+
+		return sample_collection
+
+@frappe.whitelist()
+def create_lab_test_from_desk(patient, template, prescription, invoice=None):
+	lab_test_exist = frappe.db.exists({
+		"doctype": "Lab Test",
+		"prescription": prescription
+		})
+	if lab_test_exist:
+		return
+	template = frappe.get_doc("Lab Test Template", template)
+	#skip the loop if there is no test_template for Item
+	if not (template):
+		return
+	patient = frappe.get_doc("Patient", patient)
+	consultation_id = frappe.get_value("Lab Prescription", prescription, "parent")
+	consultation = frappe.get_doc("Consultation", consultation_id)
+	lab_test = create_lab_test(patient, template, prescription, consultation, invoice)
+	return lab_test.name
+
+def create_sample_collection(lab_test, template, patient, invoice):
+	if(frappe.db.get_value("Healthcare Settings", None, "require_sample_collection") == "1"):
+		sample_collection = create_sample_doc(template, patient, invoice)
+		if(sample_collection):
+			lab_test.sample = sample_collection.name
+	return lab_test
+
+def load_result_format(lab_test, template, prescription, invoice):
+	if(template.test_template_type == 'Single'):
+		create_normals(template, lab_test)
+	elif(template.test_template_type == 'Compound'):
+		create_compounds(template, lab_test, False)
+	elif(template.test_template_type == 'Descriptive'):
+		create_specials(template, lab_test)
+	elif(template.test_template_type == 'Grouped'):
+		#iterate for each template in the group and create one result for all.
+		for test_group in template.test_groups:
+			#template_in_group = None
+			if(test_group.test_template):
+				template_in_group = frappe.get_doc("Lab Test Template",
+								test_group.test_template)
+				if(template_in_group):
+					if(template_in_group.test_template_type == 'Single'):
+						create_normals(template_in_group, lab_test)
+					elif(template_in_group.test_template_type == 'Compound'):
+						normal_heading = lab_test.append("normal_test_items")
+						normal_heading.test_name = template_in_group.test_name
+						normal_heading.require_result_value = 0
+						normal_heading.template = template_in_group.name
+						create_compounds(template_in_group, lab_test, True)
+					elif(template_in_group.test_template_type == 'Descriptive'):
+						special_heading = lab_test.append("special_test_items")
+						special_heading.test_name = template_in_group.test_name
+						special_heading.require_result_value = 0
+						special_heading.template = template_in_group.name
+						create_specials(template_in_group, lab_test)
+			else:
+				normal = lab_test.append("normal_test_items")
+				normal.test_name = test_group.group_event
+				normal.test_uom = test_group.group_test_uom
+				normal.normal_range = test_group.group_test_normal_range
+				normal.require_result_value = 1
+				normal.template = template.name
+	if(template.test_template_type != 'No Result'):
+		if(prescription):
+			lab_test.prescription = prescription
+			if(invoice):
+				frappe.db.set_value("Lab Prescription", prescription, "invoice", invoice)
+		lab_test.save(ignore_permissions=True) # insert the result
+		return lab_test
+
+def create_lab_test(patient, template, prescription,  consultation, invoice):
+	lab_test = create_lab_test_doc(invoice, consultation, patient, template)
+	lab_test = create_sample_collection(lab_test, template, patient, invoice)
+	lab_test = load_result_format(lab_test, template, prescription, invoice)
+	return lab_test
+
+@frappe.whitelist()
+def get_employee_by_user_id(user_id):
+	emp_id = frappe.db.get_value("Employee",{"user_id":user_id})
+	employee = frappe.get_doc("Employee",emp_id)
+	return employee
+
+def insert_lab_test_to_medical_record(doc):
+	subject = str(doc.test_name)
+	if(doc.test_comment):
+		subject += ", \n"+str(doc.test_comment)
+	medical_record = frappe.new_doc("Patient Medical Record")
+	medical_record.patient = doc.patient
+	medical_record.subject = subject
+	medical_record.status = "Open"
+	medical_record.communication_date = doc.result_date
+	medical_record.reference_doctype = "Lab Test"
+	medical_record.reference_name = doc.name
+	medical_record.reference_owner = doc.owner
+	medical_record.save(ignore_permissions=True)
+
+def delete_lab_test_from_medical_record(self):
+	medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(self.name))
+
+	if(medical_record_id[0][0]):
+		frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
+
+def create_item_line(test_code, sales_invoice):
+	if test_code:
+		item = frappe.get_doc("Item", test_code)
+		if item:
+			if not item.disabled:
+				sales_invoice_line = sales_invoice.append("items")
+				sales_invoice_line.item_code = item.item_code
+				sales_invoice_line.item_name =  item.item_name
+				sales_invoice_line.qty = 1.0
+				sales_invoice_line.description = item.description
+
+@frappe.whitelist()
+def create_invoice(company, patient, lab_tests, prescriptions):
+	test_ids = json.loads(lab_tests)
+	line_ids = json.loads(prescriptions)
+	if not test_ids and not line_ids:
+		return
+	sales_invoice = frappe.new_doc("Sales Invoice")
+	sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
+	sales_invoice.due_date = getdate()
+	sales_invoice.is_pos = '0'
+	sales_invoice.debit_to = get_receivable_account(company)
+	for line in line_ids:
+		test_code = frappe.get_value("Lab Prescription", line, "test_code")
+		create_item_line(test_code, sales_invoice)
+	for test in test_ids:
+		template = frappe.get_value("Lab Test", test, "template")
+		test_code = frappe.get_value("Lab Test Template", template, "item")
+		create_item_line(test_code, sales_invoice)
+	sales_invoice.set_missing_values()
+	sales_invoice.save()
+	#set invoice in lab test
+	for test in test_ids:
+		frappe.db.set_value("Lab Test", test, "invoice", sales_invoice.name)
+		prescription = frappe.db.get_value("Lab Test", test, "prescription")
+		if prescription:
+			frappe.db.set_value("Lab Prescription", prescription, "invoice", sales_invoice.name)
+	#set invoice in prescription
+	for line in line_ids:
+		frappe.db.set_value("Lab Prescription", line, "invoice", sales_invoice.name)
+	return sales_invoice.name
+
+@frappe.whitelist()
+def get_lab_test_prescribed(patient):
+	return frappe.db.sql(_("""select cp.name, cp.test_code, cp.parent, cp.invoice, ct.physician, ct.consultation_date from tabConsultation ct,
+	`tabLab Prescription` cp where ct.patient='{0}' and cp.parent=ct.name and cp.test_created=0""").format(patient))
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test_list.js b/erpnext/healthcare/doctype/lab_test/lab_test_list.js
new file mode 100644
index 0000000..c36c115
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test/lab_test_list.js
@@ -0,0 +1,15 @@
+/*
+(c) ESS 2015-16
+*/
+frappe.listview_settings['Lab Test'] = {
+	add_fields: ["name", "status", "invoice"],
+	filters:[["docstatus","=","0"]],
+	get_indicator: function(doc) {
+		if(doc.status=="Approved"){
+			return [__("Approved"), "green", "status,=,Approved"];
+		}
+		if(doc.status=="Rejected"){
+			return [__("Rejected"), "yellow", "status,=,Rejected"];
+		}
+	}
+};
diff --git a/erpnext/healthcare/doctype/lab_test/test_lab_test.js b/erpnext/healthcare/doctype/lab_test/test_lab_test.js
new file mode 100644
index 0000000..57cb22b
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test/test_lab_test.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Lab Test", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Lab Test
+		() => frappe.tests.make('Lab Test', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/lab_test/test_lab_test.py b/erpnext/healthcare/doctype/lab_test/test_lab_test.py
new file mode 100644
index 0000000..4131ad9
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test/test_lab_test.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Lab Test')
+
+class TestLabTest(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/lab_test_groups/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/lab_test_groups/__init__.py
diff --git a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
new file mode 100644
index 0000000..d5607f0
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.json
@@ -0,0 +1,291 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-03-29 17:37:29.913583", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Add Test", 
+   "depends_on": "", 
+   "fieldname": "template_or_new_line", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Add Test\nAdd new line", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.template_or_new_line == 'Add Test'", 
+   "fieldname": "test_template", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Test Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "test_template.test_rate", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_description", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "test_template.test_description", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.template_or_new_line == 'Add new line'", 
+   "fieldname": "group_event", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Event", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.template_or_new_line =='Add new line'", 
+   "fieldname": "group_test_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test UOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.template_or_new_line == 'Add new line'", 
+   "fieldname": "group_test_normal_range", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Normal Range", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_8", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:07:35.188661", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Lab Test Groups", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.py b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.py
new file mode 100644
index 0000000..c67531c
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_groups/lab_test_groups.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class LabTestGroups(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/lab_test_sample/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/lab_test_sample/__init__.py
diff --git a/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.js b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.js
new file mode 100644
index 0000000..a5f4b4d
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Lab Test Sample', {
+});
diff --git a/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.json b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.json
new file mode 100644
index 0000000..46c04c6
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.json
@@ -0,0 +1,145 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:sample", 
+ "beta": 1, 
+ "creation": "2016-04-04 17:35:44.823951", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Sample", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample_uom", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:46:22.508908", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Lab Test Sample", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 0
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "sample", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py
new file mode 100644
index 0000000..4c66b72
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class LabTestSample(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.js b/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.js
new file mode 100644
index 0000000..ace60de
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Lab Test Sample", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Lab Test Sample
+		() => frappe.tests.make('Lab Test Sample', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py b/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py
new file mode 100644
index 0000000..2bc56bd
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestLabTestSample(unittest.TestCase):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/lab_test_template/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/lab_test_template/__init__.py
diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js
new file mode 100644
index 0000000..a820298
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.js
@@ -0,0 +1,132 @@
+// Copyright (c) 2016, ESS
+// License: ESS license.txt
+
+frappe.ui.form.on("Lab Test Template",{
+	test_name: function(frm) {
+		if(!frm.doc.test_code)
+			frm.set_value("test_code", frm.doc.test_name);
+		if(!frm.doc.test_description)
+			frm.set_value("test_description", frm.doc.test_name);
+	},
+	refresh :  function(frm){
+		// Restrict Special, Grouped type templates in Child TestGroups
+		frm.set_query("test_template", "test_groups", function() {
+			return {
+				filters: {
+					test_template_type:['in',['Single','Compound']]
+				}
+			};
+		});
+	}
+});
+
+cur_frm.cscript.custom_refresh = function(doc) {
+	cur_frm.set_df_property("test_code", "read_only", doc.__islocal ? 0 : 1);
+
+	if(!doc.__islocal) {
+		cur_frm.add_custom_button(__('Change Template Code'), function() {
+			change_template_code(cur_frm,doc);
+		} );
+		if(doc.disabled == 1){
+			cur_frm.add_custom_button(__('Enable Template'), function() {
+				enable_template(cur_frm);
+			} );
+		}
+		else{
+			cur_frm.add_custom_button(__('Disable Template'), function() {
+				disable_template(cur_frm);
+			} );
+		}
+	}
+};
+
+var disable_template = function(frm){
+	var doc = frm.doc;
+	frappe.call({
+		method: 		"erpnext.healthcare.doctype.lab_test_template.lab_test_template.disable_enable_test_template",
+		args: {status: 1, name: doc.name, is_billable: doc.is_billable},
+		callback: function(){
+			cur_frm.reload_doc();
+		}
+	});
+};
+
+var enable_template = function(frm){
+	var doc = frm.doc;
+	frappe.call({
+		method: 		"erpnext.healthcare.doctype.lab_test_template.lab_test_template.disable_enable_test_template",
+		args: {status: 0, name: doc.name, is_billable: doc.is_billable},
+		callback: function(){
+			cur_frm.reload_doc();
+		}
+	});
+};
+
+
+var change_template_code = function(frm,doc){
+	var d = new frappe.ui.Dialog({
+		title:__("Change Template Code"),
+		fields:[
+			{
+				"fieldtype": "Data",
+				"label": "Test Template Code",
+				"fieldname": "Test Code",
+				reqd:1
+			},
+			{
+				"fieldtype": "Button",
+				"label": __("Change Code"),
+				click: function() {
+					var values = d.get_values();
+					if(!values)
+						return;
+					change_test_code_from_template(values["Test Code"],doc);
+					d.hide();
+				}
+			}
+		]
+	});
+	d.show();
+	d.set_values({
+		'Test Code': doc.test_code
+	});
+
+	var change_test_code_from_template = function(test_code,doc){
+		frappe.call({
+			"method": "erpnext.healthcare.doctype.lab_test_template.lab_test_template.change_test_code_from_template",
+			"args": {test_code: test_code, doc: doc},
+			callback: function (data) {
+				frappe.set_route("Form", "Lab Test Template", data.message);
+			}
+		});
+	};
+};
+
+frappe.ui.form.on("Lab Test Template", "test_name", function(frm){
+
+	frm.doc.change_in_item = 1;
+
+});
+frappe.ui.form.on("Lab Test Template", "test_rate", function(frm){
+
+	frm.doc.change_in_item = 1;
+
+});
+frappe.ui.form.on("Lab Test Template", "test_group", function(frm){
+
+	frm.doc.change_in_item = 1;
+
+});
+frappe.ui.form.on("Lab Test Template", "test_description", function(frm){
+
+	frm.doc.change_in_item = 1;
+
+});
+
+frappe.ui.form.on("Lab Test Groups", "template_or_new_line", function (frm, cdt, cdn) {
+	var child = locals[cdt][cdn];
+	if(child.template_or_new_line =="Add new line"){
+		frappe.model.set_value(cdt, cdn, 'test_template', "");
+		frappe.model.set_value(cdt, cdn, 'test_description', "");
+	}
+});
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.json
similarity index 60%
copy from erpnext/subscription/doctype/subscription/subscription.json
copy to erpnext/healthcare/doctype/lab_test_template/lab_test_template.json
index 6cfee1e..9e692d5 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.json
@@ -1,17 +1,16 @@
 {
- "allow_copy": 0, 
+ "allow_copy": 1, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
  "allow_rename": 1, 
- "autoname": "naming_series:", 
- "beta": 0, 
- "creation": "2017-07-18 17:50:43.967266", 
+ "autoname": "field:test_code", 
+ "beta": 1, 
+ "creation": "2016-03-29 17:35:36.761223", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "", 
- "editable_grid": 1, 
- "engine": "InnoDB", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_bulk_edit": 0, 
@@ -19,17 +18,18 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_1", 
-   "fieldtype": "Section Break", 
+   "fieldname": "test_name", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
+   "label": "Test Name", 
    "length": 0, 
-   "no_copy": 0, 
+   "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -37,8 +37,8 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
    "set_only_once": 0, 
    "unique": 0
   }, 
@@ -48,264 +48,23 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Series", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "SUB-", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_doctype", 
+   "fieldname": "item", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Reference Doctype", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "DocType", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_document", 
-   "fieldtype": "Dynamic Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Document", 
+   "label": "Item", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "reference_doctype", 
+   "options": "Item", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disabled", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Disabled", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "submit_on_creation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Submit on Creation", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_5", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "start_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Start Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "End Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "next_schedule_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Next Schedule Date", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
@@ -320,18 +79,18 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency_detail", 
-   "fieldtype": "Section Break", 
+   "fieldname": "test_code", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "", 
+   "label": "Item Code", 
    "length": 0, 
-   "no_copy": 0, 
+   "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -339,8 +98,8 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
    "set_only_once": 0, 
    "unique": 0
   }, 
@@ -350,19 +109,20 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
+   "description": "", 
+   "fieldname": "test_group", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
+   "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Frequency", 
+   "label": "Item Group", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDaily\nWeekly\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
+   "options": "Item Group", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -381,188 +141,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_12", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval: in_list([\"Monthly\", \"Quarterly\", \"Yearly\"], doc.frequency)", 
-   "fieldname": "repeat_on_day", 
-   "fieldtype": "Int", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Repeat on Day", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notification", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Notification", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notify_by_email", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Notify by Email", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_17", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "recipients", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Recipients", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "print_format", 
+   "fieldname": "department", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -571,10 +150,39 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Print Format", 
+   "label": "Department", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Print Format", 
+   "options": "Medical Department", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -591,9 +199,109 @@
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 1, 
+   "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_16", 
+   "default": "", 
+   "description": "Single for results which require only a single input, result UOM and normal value \n<br>\nCompound for results which require multiple input fields with corresponding event names, result UOMs and normal values\n<br>\nDescriptive for tests which have multiple result components and corresponding result entry fields. \n<br>\nGrouped for test templates which are a group of other test templates.\n<br>\nNo Result for tests with no results. Also, no Lab Test is created. e.g.. Sub Tests for Grouped results.", 
+   "fieldname": "test_template_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Result Format", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nSingle\nCompound\nDescriptive\nGrouped\nNo Result", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "1", 
+   "depends_on": "eval:doc.test_template_type != 'Grouped'", 
+   "description": "If unchecked, the item wont be appear in Sales Invoice, but can be used in group test creation. ", 
+   "fieldname": "is_billable", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Is billable", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.is_billable == 1", 
+   "description": "This value is updated in the Default Sales Price List.", 
+   "fieldname": "test_rate", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Standard Selling Rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "collapsible_depends_on": "", 
+   "columns": 0, 
+   "depends_on": "eval:doc.test_template_type == 'Single'", 
+   "fieldname": "section_break_normal", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -602,9 +310,315 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
+   "label": "Lab Routine", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test UOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_normal_range", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Normal Range", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_10", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "collapsible_depends_on": "", 
+   "columns": 0, 
+   "depends_on": "eval:doc.test_template_type == 'Compound'", 
+   "fieldname": "section_break_compound", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Compound", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "normal_test_templates", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Normal Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.test_template_type == 'Descriptive'", 
+   "fieldname": "section_break_special", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Special", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "sensitivity", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Sensitivity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "special_test_template", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Special Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.test_template_type == 'Grouped'", 
+   "fieldname": "section_break_group", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_groups", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "label": "", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Lab Test Groups", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -623,9 +637,221 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
+   "fieldname": "section_break_description", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_description", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sb_sample_collection", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Sample Collection", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Sample", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test Sample", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample_uom", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "sample.sample_uom", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "sample_quantity", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample_collection_details", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Collection Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "change_in_item", 
+   "fieldtype": "Check", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -633,15 +859,14 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Status", 
+   "label": "Change In Item", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -655,23 +880,24 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
+   "default": "0", 
+   "fieldname": "disabled", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Amended From", 
+   "label": "disabled", 
    "length": 0, 
-   "no_copy": 1, 
-   "options": "Subscription", 
+   "no_copy": 0, 
    "permlevel": 0, 
-   "print_hide": 1, 
+   "precision": "", 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -686,21 +912,21 @@
  "idx": 0, 
  "image_view": 0, 
  "in_create": 0, 
- "is_submittable": 1, 
+ "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-08-31 13:45:27.655822", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
- "name": "Subscription", 
+ "module": "Healthcare", 
+ "name": "Lab Test Template", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
-   "cancel": 1, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
@@ -711,21 +937,42 @@
    "print": 1, 
    "read": 1, 
    "report": 1, 
-   "role": "System Manager", 
+   "role": "Healthcare Administrator", 
    "set_user_permissions": 0, 
    "share": 1, 
-   "submit": 1, 
+   "submit": 0, 
    "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 0
   }
  ], 
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "reference_document", 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "test_code,test_name,test_template_type", 
  "show_name_in_global_search": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "reference_document", 
+ "title_field": "test_name", 
  "track_changes": 1, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py
new file mode 100644
index 0000000..bb0ead6
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py
@@ -0,0 +1,121 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe, json
+from frappe.model.document import Document
+from frappe import _
+
+class LabTestTemplate(Document):
+	def on_update(self):
+		#Item and Price List update --> if (change_in_item)
+		if(self.change_in_item and self.is_billable == 1 and self.item):
+			updating_item(self)
+			if not item_price_exist(self):
+				if(self.test_rate != 0.0):
+					price_list_name = frappe.db.get_value("Price List", {"selling": 1})
+					if(self.test_rate):
+						make_item_price(self.test_code, price_list_name, self.test_rate)
+					else:
+						make_item_price(self.test_code, price_list_name, 0.0)
+
+			frappe.db.set_value(self.doctype,self.name,"change_in_item",0)
+		elif(self.is_billable == 0 and self.item):
+			frappe.db.set_value("Item",self.item,"disabled",1)
+		self.reload()
+
+	def after_insert(self):
+		if not self.item:
+			create_item_from_template(self)
+
+	#Call before delete the template
+	def on_trash(self):
+		# remove template refernce from item and disable item
+		if(self.item):
+			try:
+				frappe.delete_doc("Item",self.item)
+			except Exception:
+				frappe.throw("""Not permitted. Please disable the Test Template""")
+
+def item_price_exist(doc):
+	item_price = frappe.db.exists({
+	"doctype": "Item Price",
+	"item_code": doc.test_code})
+	if(item_price):
+		return True
+	else:
+		return False
+
+def updating_item(self):
+	frappe.db.sql("""update `tabItem` set item_name=%s, item_group=%s, disabled=0, standard_rate=%s,
+		description=%s, modified=NOW() where item_code=%s""",
+		(self.test_name, self.test_group , self.test_rate, self.test_description, self.item))
+
+def create_item_from_template(doc):
+	if(doc.is_billable == 1):
+		disabled = 0
+	else:
+		disabled = 1
+	#insert item
+	item =  frappe.get_doc({
+	"doctype": "Item",
+	"item_code": doc.test_code,
+	"item_name":doc.test_name,
+	"item_group": doc.test_group,
+	"description":doc.test_description,
+	"is_sales_item": 1,
+	"is_service_item": 1,
+	"is_purchase_item": 0,
+	"is_stock_item": 0,
+	"show_in_website": 0,
+	"is_pro_applicable": 0,
+	"disabled": disabled,
+	"stock_uom": "Unit"
+	}).insert(ignore_permissions=True)
+
+	#insert item price
+	#get item price list to insert item price
+	if(doc.test_rate != 0.0):
+		price_list_name = frappe.db.get_value("Price List", {"selling": 1})
+		if(doc.test_rate):
+			make_item_price(item.name, price_list_name, doc.test_rate)
+			item.standard_rate = doc.test_rate
+		else:
+			make_item_price(item.name, price_list_name, 0.0)
+			item.standard_rate = 0.0
+	item.save(ignore_permissions = True)
+	#Set item to the template
+	frappe.db.set_value("Lab Test Template", doc.name, "item", item.name)
+
+	doc.reload() #refresh the doc after insert.
+
+def make_item_price(item, price_list_name, item_price):
+	frappe.get_doc({
+		"doctype": "Item Price",
+		"price_list": price_list_name,
+		"item_code": item,
+		"price_list_rate": item_price
+	}).insert(ignore_permissions=True)
+
+@frappe.whitelist()
+def change_test_code_from_template(test_code, doc):
+	args = json.loads(doc)
+	doc = frappe._dict(args)
+
+	item_exist = frappe.db.exists({
+		"doctype": "Item",
+		"item_code": test_code})
+	if(item_exist):
+		frappe.throw(_("Code {0} already exist").format(test_code))
+	else:
+		frappe.rename_doc("Item", doc.name, test_code, ignore_permissions = True)
+		frappe.db.set_value("Lab Test Template",doc.name,"test_code",test_code)
+		frappe.rename_doc("Lab Test Template", doc.name, test_code, ignore_permissions = True)
+	return test_code
+
+@frappe.whitelist()
+def disable_enable_test_template(status, name,  is_billable):
+	frappe.db.set_value("Lab Test Template",name,"disabled",status)
+	if(is_billable == 1):
+		frappe.db.set_value("Item",name,"disabled",status)
diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js b/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js
new file mode 100644
index 0000000..26f55c3
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template_list.js
@@ -0,0 +1,15 @@
+/*
+(c) ESS 2015-16
+*/
+frappe.listview_settings['Lab Test Template'] = {
+	add_fields: ["test_name", "test_code", "test_rate"],
+	filters:[["disabled","=",0]],
+	/*	get_indicator: function(doc) {
+		if(doc.disabled==1){
+        		return [__("Disabled"), "red", "disabled,=,Disabled"];
+        	}
+		if(doc.disabled==0){
+        		return [__("Enabled"), "green", "disabled,=,0"];
+        	}
+	}		*/
+};
diff --git a/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.js b/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.js
new file mode 100644
index 0000000..7c2ec8c
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Lab Test Template", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Lab Test Template
+		() => frappe.tests.make('Lab Test Template', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py b/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py
new file mode 100644
index 0000000..4c9f55a
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Lab Test Template')
+
+class TestLabTestTemplate(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/lab_test_uom/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/lab_test_uom/__init__.py
diff --git a/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.js b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.js
new file mode 100644
index 0000000..2107e79
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Lab Test UOM', {
+});
diff --git a/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.json b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.json
new file mode 100644
index 0000000..daa533d
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.json
@@ -0,0 +1,145 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:test_uom", 
+ "beta": 1, 
+ "creation": "2016-03-29 17:28:08.630148", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_uom", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Test UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "uom_description", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:41:40.186676", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Lab Test UOM", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 0
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "test_uom", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "test_uom", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
new file mode 100644
index 0000000..7ce8d2d
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class LabTestUOM(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.js b/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.js
new file mode 100644
index 0000000..1328dda
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Lab Test UOM", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Lab Test UOM
+		() => frappe.tests.make('Lab Test UOM', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py b/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
new file mode 100644
index 0000000..0b3f516
--- /dev/null
+++ b/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Lab Test UOM')
+
+class TestLabTestUOM(unittest.TestCase):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/medical_code/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/medical_code/__init__.py
diff --git a/erpnext/healthcare/doctype/medical_code/medical_code.js b/erpnext/healthcare/doctype/medical_code/medical_code.js
new file mode 100644
index 0000000..0422d77
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code/medical_code.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Medical Code', {
+});
diff --git a/erpnext/healthcare/doctype/medical_code/medical_code.json b/erpnext/healthcare/doctype/medical_code/medical_code.json
new file mode 100644
index 0000000..71a2278
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code/medical_code.json
@@ -0,0 +1,156 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "beta": 1, 
+ "creation": "2017-06-21 13:02:56.122897", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "medical_code_standard", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Medical Code Standard", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Medical Code Standard", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "code", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:01:18.817484", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Medical Code", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "code, description", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/medical_code/medical_code.py b/erpnext/healthcare/doctype/medical_code/medical_code.py
new file mode 100644
index 0000000..0deaac3
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code/medical_code.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class MedicalCode(Document):
+	def autoname(self):
+		self.name = self.medical_code_standard+" "+self.code
diff --git a/erpnext/healthcare/doctype/medical_code/test_medical_code.js b/erpnext/healthcare/doctype/medical_code/test_medical_code.js
new file mode 100644
index 0000000..8cc7c40
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code/test_medical_code.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Medical Code", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Medical Code
+		() => frappe.tests.make('Medical Code', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/medical_code/test_medical_code.py b/erpnext/healthcare/doctype/medical_code/test_medical_code.py
new file mode 100644
index 0000000..b1e0402
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code/test_medical_code.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestMedicalCode(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/medical_code_standard/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/medical_code_standard/__init__.py
diff --git a/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.js b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.js
new file mode 100644
index 0000000..4bf6d3e
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Medical Code Standard', {
+});
diff --git a/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.json b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.json
new file mode 100644
index 0000000..886938d
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.json
@@ -0,0 +1,94 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:medical_code", 
+ "beta": 1, 
+ "creation": "2017-06-21 13:07:00.463176", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "medical_code", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Medical Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:15:40.820693", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Medical Code Standard", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py
new file mode 100644
index 0000000..7b2731c
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class MedicalCodeStandard(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.js b/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.js
new file mode 100644
index 0000000..6ab6d53
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Medical Code Standard", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Medical Code Standard
+		() => frappe.tests.make('Medical Code Standard', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py b/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py
new file mode 100644
index 0000000..fde095d
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestMedicalCodeStandard(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/medical_department/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/medical_department/__init__.py
diff --git a/erpnext/healthcare/doctype/medical_department/medical_department.js b/erpnext/healthcare/doctype/medical_department/medical_department.js
new file mode 100644
index 0000000..25aeeb8
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_department/medical_department.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Medical Department', {
+});
diff --git a/erpnext/healthcare/doctype/medical_department/medical_department.json b/erpnext/healthcare/doctype/medical_department/medical_department.json
new file mode 100644
index 0000000..40f14ca
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_department/medical_department.json
@@ -0,0 +1,156 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:department", 
+ "beta": 1, 
+ "creation": "2017-02-27 13:38:30.806362", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "department", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:41:59.611698", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Medical Department", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Nursing User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "department", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "department", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/medical_department/medical_department.py b/erpnext/healthcare/doctype/medical_department/medical_department.py
new file mode 100644
index 0000000..0f2d4fc
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_department/medical_department.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class MedicalDepartment(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/medical_department/test_medical_department.js b/erpnext/healthcare/doctype/medical_department/test_medical_department.js
new file mode 100644
index 0000000..fdf4971
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_department/test_medical_department.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Medical Department", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Medical Department
+		() => frappe.tests.make('Medical Department', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/medical_department/test_medical_department.py b/erpnext/healthcare/doctype/medical_department/test_medical_department.py
new file mode 100644
index 0000000..543750a
--- /dev/null
+++ b/erpnext/healthcare/doctype/medical_department/test_medical_department.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Medical Department')
+
+class TestMedicalDepartment(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/normal_test_items/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/normal_test_items/__init__.py
diff --git a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.js b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.js
new file mode 100644
index 0000000..0371ddd
--- /dev/null
+++ b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.js
@@ -0,0 +1,4 @@
+// Copyright (c) 2016, ESS
+// License: ESS license.txt
+
+
diff --git a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.json b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.json
new file mode 100644
index 0000000..9e754a7
--- /dev/null
+++ b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.json
@@ -0,0 +1,284 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-02-22 15:06:08.295224", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 1, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Test Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_event", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Event", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.require_result_value == 1 ", 
+   "fieldname": "result_value", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Result Value", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_uom", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "normal_range", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Normal Range", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_comment", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Comment", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "require_result_value", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Require Result Value", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "template", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Template", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:59:33.202695", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Normal Test Items", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/normal_test_items/normal_test_items.py b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.py
new file mode 100644
index 0000000..a0069d7
--- /dev/null
+++ b/erpnext/healthcare/doctype/normal_test_items/normal_test_items.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class NormalTestItems(Document):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/normal_test_template/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/normal_test_template/__init__.py
diff --git a/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json
new file mode 100644
index 0000000..ef5abd5
--- /dev/null
+++ b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.json
@@ -0,0 +1,191 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-02-22 16:09:54.310628", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 1, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "heading_text", 
+   "fieldtype": "Heading", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Test", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_event", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Event", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test UOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "normal_range", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Normal Range", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_5", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:07:11.277187", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Normal Test Template", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py
new file mode 100644
index 0000000..bc2c991
--- /dev/null
+++ b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class NormalTestTemplate(Document):
+	pass
diff --git a/erpnext/subscription/__init__.py b/erpnext/healthcare/doctype/patient/__init__.py
similarity index 100%
copy from erpnext/subscription/__init__.py
copy to erpnext/healthcare/doctype/patient/__init__.py
diff --git a/erpnext/healthcare/doctype/patient/patient.js b/erpnext/healthcare/doctype/patient/patient.js
new file mode 100644
index 0000000..57e5eef
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient/patient.js
@@ -0,0 +1,119 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Patient', {
+	refresh: function (frm) {
+		frm.set_query("patient", "patient_relation", function () {
+			return {
+				filters: [
+					["Patient", "name", "!=", frm.doc.name]
+				]
+			};
+		});
+		if (frappe.defaults.get_default("patient_master_name") != "Naming Series") {
+			frm.toggle_display("naming_series", false);
+		} else {
+			erpnext.toggle_naming_series();
+		}
+		if (frappe.defaults.get_default("collect_registration_fee") && frm.doc.disabled == 1) {
+			frm.add_custom_button(__('Invoice Patient Registration'), function () {
+				btn_invoice_registration(frm);
+			});
+		}
+		if (frm.doc.patient_name && frappe.user.has_role("Physician")) {
+			frm.add_custom_button(__('Medical Record'), function () {
+				frappe.route_options = { "patient": frm.doc.name };
+				frappe.set_route("medical_record");
+			},"View");
+		}
+		if (!frm.doc.__islocal && (frappe.user.has_role("Nursing User") || frappe.user.has_role("Physician"))) {
+			frm.add_custom_button(__('Vital Signs'), function () {
+				btn_create_vital_signs(frm);
+			}, "Create");
+			frm.add_custom_button(__('Medical Record'), function () {
+				create_medical_record(frm);
+			}, "Create");
+			frm.add_custom_button(__('Consultation'), function () {
+				btn_create_consultation(frm);
+			}, "Create");
+		}
+	},
+	onload: function (frm) {
+		if(!frm.doc.dob){
+			$(frm.fields_dict['age_html'].wrapper).html("Age not specified");
+		}
+		if(frm.doc.dob){
+			$(frm.fields_dict['age_html'].wrapper).html("AGE : " + get_age(frm.doc.dob));
+		}
+	}
+});
+
+frappe.ui.form.on("Patient", "dob", function(frm) {
+	if(frm.doc.dob){
+		var today = new Date();
+		var birthDate = new Date(frm.doc.dob);
+		if(today < birthDate){
+			frappe.msgprint("Please select a valid Date");
+			frappe.model.set_value(frm.doctype,frm.docname, "dob", "");
+		}
+		else{
+			var age_str = get_age(frm.doc.dob);
+			$(frm.fields_dict['age_html'].wrapper).html("AGE : " + age_str);
+		}
+	}
+});
+
+var create_medical_record = function (frm) {
+	frappe.route_options = {
+		"patient": frm.doc.name,
+		"status": "Open",
+		"reference_doctype": "Patient Medical Record",
+		"reference_owner": frm.doc.owner
+	};
+	frappe.new_doc("Patient Medical Record");
+};
+
+var get_age = function (birth) {
+	var ageMS = Date.parse(Date()) - Date.parse(birth);
+	var age = new Date();
+	age.setTime(ageMS);
+	var years = age.getFullYear() - 1970;
+	return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
+};
+
+var btn_create_vital_signs = function (frm) {
+	if (!frm.doc.name) {
+		frappe.throw("Please save the patient first");
+	}
+	frappe.route_options = {
+		"patient": frm.doc.name,
+	};
+	frappe.new_doc("Vital Signs");
+};
+
+var btn_create_consultation = function (frm) {
+	if (!frm.doc.name) {
+		frappe.throw("Please save the patient first");
+	}
+	frappe.route_options = {
+		"patient": frm.doc.name,
+	};
+	frappe.new_doc("Consultation");
+};
+
+var btn_invoice_registration = function (frm) {
+	frappe.call({
+		doc: frm.doc,
+		method: "invoice_patient_registration",
+		callback: function(data){
+			if(!data.exc){
+				if(data.message.invoice){
+					/* frappe.show_alert(__('Sales Invoice {0} created',
+					['<a href="#Form/Sales Invoice/'+data.message.invoice+'">' + data.message.invoice+ '</a>'])); */
+					frappe.set_route("Form", "Sales Invoice", data.message.invoice);
+				}
+				cur_frm.reload_doc();
+			}
+		}
+	});
+};
diff --git a/erpnext/healthcare/doctype/patient/patient.json b/erpnext/healthcare/doctype/patient/patient.json
new file mode 100644
index 0000000..f5ce458
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient/patient.json
@@ -0,0 +1,1356 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "autoname": "naming_series:", 
+ "beta": 1, 
+ "creation": "2017-01-23 14:03:49.084370", 
+ "custom": 0, 
+ "description": "Patient", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "basic_info", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Demographics", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-user", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient ID", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "PID-", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Full Name", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sex", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Gender", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nMale\nFemale", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "blood_group", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Blood Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nA Positive\nA Negative\nAB Positive\nAB Negative\nB Positive\nB Negative\nO Positive\nO Negative", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "dob", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "DOB", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "age_html", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Age", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Active", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Active\nDormant\nOpen", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "image", 
+   "fieldtype": "Attach Image", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "50%"
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_14", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "customer", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Customer", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Customer", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "report_preference", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Report Preference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nEmail\nPrint", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "mobile", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Mobile", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "email", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Email", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Email", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "phone", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Phone", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "disabled", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Disabled", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "sb_relation", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Relation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_relation", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Relation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient Relation", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "allergy_medical_and_surgical_history", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Allergies, Medical and Surgical History", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "allergies", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Allergies", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "medication", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Medication", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_20", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "medical_history", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Medical History", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "surgical_history", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Surgical History", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "personal_and_social_history", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Personal and Social History", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "occupation", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Occupation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_25", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "marital_status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Marital Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Single\nMarried\nDivorced\nWidow", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "risk_factors", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Risk Factors", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "tobacco_past_use", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Tobacco Past Use", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "tobacco_current_use", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Tobacco Current Use", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "alcohol_past_use", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Alcohol Past Use", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "alcohol_current_use", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Alcohol Current Use", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_32", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "surrounding_factors", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Occupational Hazards and Environmental Factors", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "other_risk_factors", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Other Risk Factors", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "patient_details", 
+   "columns": 0, 
+   "fieldname": "more_info", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "More Information", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "fa fa-file-text", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Additional information regarding the patient", 
+   "fieldname": "patient_details", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "ac_sb", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Account Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "default_currency", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "fa fa-user", 
+ "idx": 0, 
+ "image_field": "image", 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 50, 
+ "modified": "2017-08-31 13:50:25.474398", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Patient", 
+ "name_case": "Title Case", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Nursing User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient_name,mobile,email,phone", 
+ "show_name_in_global_search": 1, 
+ "sort_field": "modified", 
+ "sort_order": "ASC", 
+ "title_field": "patient_name", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py
new file mode 100644
index 0000000..98526cc
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient/patient.py
@@ -0,0 +1,122 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.utils import cint, cstr, getdate
+import dateutil
+from frappe.model.naming import make_autoname
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account,send_registration_sms
+
+class Patient(Document):
+	def after_insert(self):
+		if(frappe.db.get_value("Healthcare Settings", None, "manage_customer") == '1' and not self.customer):
+			create_customer(self)
+		if(frappe.db.get_value("Healthcare Settings", None, "collect_registration_fee") == '1'):
+			frappe.db.set_value("Patient", self.name, "disabled", 1)
+		else:
+			send_registration_sms(self)
+		self.reload()
+
+	def on_update(self):
+		self.add_as_website_user()
+
+	def add_as_website_user(self):
+		if(self.email):
+			if not frappe.db.exists ("User", self.email):
+				user = frappe.get_doc({
+					"doctype": "User",
+					"first_name": self.patient_name,
+					"email": self.email,
+					"user_type": "Website User"
+				})
+				user.flags.no_welcome_email = True
+				user.flags.ignore_permissions = True
+				user.add_roles("Patient")
+
+	def autoname(self):
+		patient_master_name = frappe.defaults.get_global_default('patient_master_name')
+		if patient_master_name == 'Patient Name':
+			self.name = self.get_patient_name()
+		else:
+			if not self.naming_series:
+				frappe.throw(_("Series is mandatory"), frappe.MandatoryError)
+
+			self.name = make_autoname(self.naming_series+'.#####')
+
+	def get_patient_name(self):
+		name = self.patient_name
+		if frappe.db.get_value("Patient", name):
+			count = frappe.db.sql("""select ifnull(MAX(CAST(SUBSTRING_INDEX(name, ' ', -1) AS UNSIGNED)), 0) from tabPatient
+				 where name like %s""", "%{0} - %".format(name), as_list=1)[0][0]
+			count = cint(count) + 1
+			return "{0} - {1}".format(name, cstr(count))
+
+		return name
+
+	def get_age(self):
+		age_str = ""
+		if self.dob:
+			born = getdate(self.dob)
+			age = dateutil.relativedelta.relativedelta(getdate(), born)
+			age_str = str(age.years) + " year(s) " + str(age.months) + " month(s) " + str(age.days) + " day(s)"
+		return age_str
+
+	def invoice_patient_registration(self):
+		frappe.db.set_value("Patient", self.name, "disabled", 0)
+		send_registration_sms(self)
+		if(frappe.get_value("Healthcare Settings", None, "registration_fee")>0):
+			sales_invoice = make_invoice(self.name, self.company)
+			sales_invoice.save(ignore_permissions=True)
+			return {'invoice': sales_invoice.name}
+
+def create_customer(doc):
+	customer_group = frappe.get_value("Selling Settings", None, "customer_group")
+	territory = frappe.get_value("Selling Settings", None, "territory")
+	if not (customer_group and territory):
+		customer_group = "Commercial"
+		territory = "Rest Of The World"
+		frappe.msgprint(_("Please set default customer group and territory in Selling Settings"), alert=True)
+	customer = frappe.get_doc({"doctype": "Customer",
+	"customer_name": doc.name,
+	"customer_group": customer_group,
+	"territory" : territory,
+	"customer_type": "Individual"
+	}).insert(ignore_permissions=True)
+	frappe.db.set_value("Patient", doc.name, "customer", customer.name)
+	frappe.msgprint(_("Customer {0} is created.").format(customer.name), alert=True)
+
+def make_invoice(patient, company):
+	sales_invoice = frappe.new_doc("Sales Invoice")
+	sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
+	sales_invoice.due_date = getdate()
+	sales_invoice.company = company
+	sales_invoice.is_pos = '0'
+	sales_invoice.debit_to = get_receivable_account(company)
+
+	item_line = sales_invoice.append("items")
+	item_line.item_name = "Registeration Fee"
+	item_line.description = "Registeration Fee"
+	item_line.qty = 1
+	item_line.uom = "Nos"
+	item_line.conversion_factor = 1
+	item_line.income_account = get_income_account(None, company)
+	item_line.rate = frappe.get_value("Healthcare Settings", None, "registration_fee")
+	item_line.amount = item_line.rate
+	sales_invoice.set_missing_values()
+	return sales_invoice
+
+@frappe.whitelist()
+def get_patient_detail(patient, company=None):
+	patient_dict = frappe.db.sql(_("""select * from tabPatient where name='{0}'""").format(patient), as_dict=1)
+	if not patient_dict:
+		frappe.throw("Patient not found")
+	vital_sign = frappe.db.sql(_("""select * from `tabVital Signs` where patient='{0}' order by signs_date desc limit 1""").format(patient), as_dict=1)
+
+	details = patient_dict[0]
+	if vital_sign:
+		details.update(vital_sign[0])
+	return details
diff --git a/erpnext/healthcare/doctype/patient/patient_dashboard.py b/erpnext/healthcare/doctype/patient/patient_dashboard.py
new file mode 100644
index 0000000..cb98f0d
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient/patient_dashboard.py
@@ -0,0 +1,18 @@
+from frappe import _
+
+def get_data():
+	return {
+		'heatmap': True,
+		'heatmap_message': _('This is based on transactions against this Patient. See timeline below for details'),
+		'fieldname': 'patient',
+		'transactions': [
+			{
+				'label': _('Appointments and Consultations'),
+				'items': ['Patient Appointment', 'Consultation']
+			},
+			{
+				'label': _('Lab Tests'),
+				'items': ['Lab Test']
+			}
+		]
+	}
diff --git a/erpnext/healthcare/doctype/patient/test_patient.js b/erpnext/healthcare/doctype/patient/test_patient.js
new file mode 100644
index 0000000..e1d9ecb
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient/test_patient.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Patient", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially('Patient', [
+		// insert a new Patient
+		() => frappe.tests.make([
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/patient/test_patient.py b/erpnext/healthcare/doctype/patient/test_patient.py
new file mode 100644
index 0000000..aebaa6b
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient/test_patient.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+# test_records = frappe.get_test_records('Patient')
+
+class TestPatient(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/patient_appointment/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/patient_appointment/__init__.py
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
new file mode 100644
index 0000000..86b1884
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
@@ -0,0 +1,256 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+frappe.provide("erpnext.queries");
+frappe.ui.form.on('Patient Appointment', {
+	setup: function(frm) {
+		frm.custom_make_buttons = {
+			'Sales Invoice': 'Invoice',
+			'Vital Signs': 'Vital Signs',
+			'Consultation': 'Consultation'
+		};
+	},
+	refresh: function(frm) {
+		frm.set_query("patient", function () {
+			return {
+				filters: {"disabled": 0}
+			};
+		});
+		if(frm.doc.patient){
+			frm.add_custom_button(__('Medical Record'), function() {
+				frappe.route_options = {"patient": frm.doc.patient};
+				frappe.set_route("medical_record");
+			},__("View"));
+		}
+		if(frm.doc.status == "Open"){
+			frm.add_custom_button(__('Cancel'), function() {
+				btn_update_status(frm, "Cancelled");
+			});
+		}
+		if(frm.doc.status == "Scheduled" && !frm.doc.__islocal){
+			frm.add_custom_button(__('Cancel'), function() {
+				btn_update_status(frm, "Cancelled");
+			});
+		}
+		if(frm.doc.status == "Pending"){
+			frm.add_custom_button(__('Set Open'), function() {
+				btn_update_status(frm, "Open");
+			});
+			frm.add_custom_button(__('Cancel'), function() {
+				btn_update_status(frm, "Cancelled");
+			});
+		}
+
+		frm.add_custom_button(__("Consultation"),function(){
+			btn_create_consultation(frm);
+		},"Create");
+
+		frm.add_custom_button(__('Vital Signs'), function() {
+			btn_create_vital_signs(frm);
+		},"Create");
+
+		if(!frm.doc.__islocal){
+			if(frm.doc.sales_invoice && frappe.user.has_role("Accounts User")){
+				frm.add_custom_button(__('Invoice'), function() {
+					frappe.set_route("Form", "Sales Invoice", frm.doc.sales_invoice);
+				},__("View") );
+			}
+			else if(frm.doc.status != "Cancelled" && frappe.user.has_role("Accounts User")){
+				frm.add_custom_button(__('Invoice'), function() {
+					btn_invoice_consultation(frm);
+				},__("Create"));
+			}
+		}
+	},
+	check_availability: function(frm) {
+		var { physician, appointment_date } = frm.doc;
+		if(!(physician && appointment_date)) {
+			frappe.throw(__("Please select Physician and Date"));
+		}
+
+		// show booking modal
+		frm.call({
+			method: 'get_availability_data',
+			args: {
+				physician: physician,
+				date: appointment_date
+			},
+			callback: (r) => {
+				// console.log(r);
+				var data = r.message;
+				if(data.available_slots.length > 0) {
+					show_availability(data);
+				} else {
+					show_empty_state();
+				}
+			}
+		});
+
+		function show_empty_state() {
+			frappe.msgprint({
+				title: __('Not Available'),
+				message: __("Physician {0} not available on {1}", [physician.bold(), appointment_date.bold()]),
+				indicator: 'red'
+			});
+		}
+
+		function show_availability(data) {
+			var d = new frappe.ui.Dialog({
+				title: __("Available slots"),
+				fields: [{ fieldtype: 'HTML', fieldname: 'available_slots'}],
+				primary_action_label: __("Book"),
+				primary_action: function() {
+					// book slot
+					frm.set_value('appointment_time', selected_slot);
+					frm.set_value('duration', data.time_per_appointment);
+					d.hide();
+					frm.save();
+				}
+			});
+			var $wrapper = d.fields_dict.available_slots.$wrapper;
+			var selected_slot = null;
+
+			// disable dialog action initially
+			d.get_primary_btn().attr('disabled', true);
+
+			// make buttons for each slot
+			var slot_html = data.available_slots.map(slot => {
+				return `<button class="btn btn-default"
+					data-name=${slot.from_time}
+					style="margin: 0 10px 10px 0; width: 72px">
+					${slot.from_time.substring(0, slot.from_time.length - 3)}
+				</button>`;
+			}).join("");
+
+			$wrapper
+				.css('margin-bottom', 0)
+				.addClass('text-center')
+				.html(slot_html);
+
+			// disable buttons for which appointments are booked
+			data.appointments.map(slot => {
+				if(slot.status == "Scheduled" || slot.status == "Open" || slot.status == "Closed"){
+					$wrapper
+						.find(`button[data-name="${slot.appointment_time}"]`)
+						.attr('disabled', true);
+				}
+			});
+
+			// blue button when clicked
+			$wrapper.on('click', 'button', function() {
+				var $btn = $(this);
+				$wrapper.find('button').removeClass('btn-primary');
+				$btn.addClass('btn-primary');
+				selected_slot = $btn.attr('data-name');
+
+				// enable dialog action
+				d.get_primary_btn().attr('disabled', null);
+			});
+
+			d.show();
+		}
+	},
+	onload:function(frm){
+		if(frm.is_new()) {
+			frm.set_value("appointment_time", null);
+			frm.disable_save();
+		}
+	},
+});
+
+var btn_create_consultation = function(frm){
+	var doc = frm.doc;
+	frappe.call({
+		method:"erpnext.healthcare.doctype.patient_appointment.patient_appointment.create_consultation",
+		args: {appointment: doc.name},
+		callback: function(data){
+			if(!data.exc){
+				var doclist = frappe.model.sync(data.message);
+				frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
+			}
+		}
+	});
+};
+
+var btn_create_vital_signs = function (frm) {
+	if(!frm.doc.patient){
+		frappe.throw("Please select patient");
+	}
+	frappe.route_options = {
+		"patient": frm.doc.patient,
+	};
+	frappe.new_doc("Vital Signs");
+};
+
+var btn_update_status = function(frm, status){
+	var doc = frm.doc;
+	frappe.call({
+		method:
+		"erpnext.healthcare.doctype.patient_appointment.patient_appointment.update_status",
+		args: {appointmentId: doc.name, status:status},
+		callback: function(data){
+			if(!data.exc){
+				cur_frm.reload_doc();
+			}
+		}
+	});
+};
+
+var btn_invoice_consultation = function(frm){
+	var doc = frm.doc;
+	frappe.call({
+		method:
+		"erpnext.healthcare.doctype.patient_appointment.patient_appointment.create_invoice",
+		args: {company: doc.company, physician:doc.physician, patient: doc.patient,
+			appointment_id: doc.name, appointment_date:doc.appointment_date },
+		callback: function(data){
+			if(!data.exc){
+				if(data.message){
+					frappe.set_route("Form", "Sales Invoice", data.message);
+				}
+				cur_frm.reload_doc();
+			}
+		}
+	});
+};
+
+frappe.ui.form.on("Patient Appointment", "physician", function(frm) {
+	if(frm.doc.physician){
+		frappe.call({
+			"method": "frappe.client.get",
+			args: {
+				doctype: "Physician",
+				name: frm.doc.physician
+			},
+			callback: function (data) {
+				frappe.model.set_value(frm.doctype,frm.docname, "department",data.message.department);
+			}
+		});
+	}
+});
+
+frappe.ui.form.on("Patient Appointment", "patient", function(frm) {
+	if(frm.doc.patient){
+		frappe.call({
+			"method": "frappe.client.get",
+			args: {
+				doctype: "Patient",
+				name: frm.doc.patient
+			},
+			callback: function (data) {
+				var age = null;
+				if(data.message.dob){
+					age = calculate_age(data.message.dob);
+				}
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
+			}
+		});
+	}
+});
+
+var calculate_age = function(birth) {
+	var ageMS = Date.parse(Date()) - Date.parse(birth);
+	var age = new Date();
+	age.setTime(ageMS);
+	var years =  age.getFullYear() - 1970;
+	return  years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
+};
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.json
similarity index 74%
copy from erpnext/subscription/doctype/subscription/subscription.json
copy to erpnext/healthcare/doctype/patient_appointment/patient_appointment.json
index 6cfee1e..9520e77 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.json
@@ -1,16 +1,16 @@
 {
- "allow_copy": 0, 
+ "allow_copy": 1, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
- "allow_rename": 1, 
- "autoname": "naming_series:", 
- "beta": 0, 
- "creation": "2017-07-18 17:50:43.967266", 
+ "allow_rename": 0, 
+ "autoname": "OP-.######", 
+ "beta": 1, 
+ "creation": "2017-05-04 11:52:40.941507", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
- "document_type": "", 
- "editable_grid": 1, 
+ "document_type": "Document", 
+ "editable_grid": 0, 
  "engine": "InnoDB", 
  "fields": [
   {
@@ -19,6 +19,221 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Patient", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Physician", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Physician", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "appointment_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.__islocal", 
+   "fieldname": "check_availability", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Check availability", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Scheduled", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nScheduled\nOpen\nClosed\nPending\nCancelled", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "appointment_type", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Appointment Type", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -48,8 +263,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
+   "fieldname": "appointment_time", 
+   "fieldtype": "Time", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -57,10 +272,9 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Series", 
+   "label": "Time", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "SUB-", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -70,7 +284,7 @@
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
-   "set_only_once": 0, 
+   "set_only_once": 1, 
    "unique": 0
   }, 
   {
@@ -79,39 +293,9 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_doctype", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Reference Doctype", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "DocType", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_document", 
-   "fieldtype": "Dynamic Link", 
+   "description": "In Minutes", 
+   "fieldname": "duration", 
+   "fieldtype": "Int", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -119,68 +303,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Document", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "reference_doctype", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disabled", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Disabled", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "submit_on_creation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Submit on Creation", 
+   "label": "Duration", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -201,7 +324,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_5", 
+   "fieldname": "appointment_datetime", 
+   "fieldtype": "Datetime", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Date TIme", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -230,8 +383,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "start_date", 
-   "fieldtype": "Date", 
+   "fieldname": "department", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -239,39 +392,10 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Start Date", 
+   "label": "Department", 
    "length": 0, 
    "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "End Date", 
-   "length": 0, 
-   "no_copy": 0, 
+   "options": "Medical Department", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -281,17 +405,17 @@
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
-   "set_only_once": 0, 
+   "set_only_once": 1, 
    "unique": 0
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "next_schedule_date", 
-   "fieldtype": "Date", 
+   "fieldname": "sales_invoice", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -299,12 +423,13 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Next Schedule Date", 
+   "label": "Sales Invoice", 
    "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
+   "options": "Sales Invoice", 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 1, 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "remember_last_selected_value": 0, 
@@ -320,7 +445,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency_detail", 
+   "fieldname": "section_break_2", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -329,7 +454,6 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -350,98 +474,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Frequency", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nDaily\nWeekly\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_12", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval: in_list([\"Monthly\", \"Quarterly\", \"Yearly\"], doc.frequency)", 
-   "fieldname": "repeat_on_day", 
-   "fieldtype": "Int", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Repeat on Day", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notification", 
+   "fieldname": "patient_details", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -450,7 +483,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Notification", 
+   "label": "Patient Details", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -471,8 +504,9 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "notify_by_email", 
-   "fieldtype": "Check", 
+   "depends_on": "patient", 
+   "fieldname": "patient_name", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -480,14 +514,14 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Notify by Email", 
+   "label": "Patient Name", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
+   "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -501,8 +535,39 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_17", 
-   "fieldtype": "Column Break", 
+   "fieldname": "patient_sex", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Gender", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "patient.sex", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient_age", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -510,13 +575,15 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
+   "label": "Patient Age", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
+   "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -530,51 +597,19 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "recipients", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Recipients", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "print_format", 
+   "fieldname": "company", 
    "fieldtype": "Link", 
-   "hidden": 0, 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Print Format", 
+   "label": "Company", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Print Format", 
+   "options": "Company", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -593,7 +628,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "columns": 0, 
-   "fieldname": "section_break_16", 
+   "fieldname": "section_break_3", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -602,7 +637,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
+   "label": "More Info", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -623,25 +658,23 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
+   "fieldname": "notes", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Status", 
+   "label": "Notes", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -655,7 +688,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "amended_from", 
+   "fieldname": "referring_physician", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -664,14 +697,46 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Amended From", 
+   "label": "Referring Physician", 
    "length": 0, 
-   "no_copy": 1, 
-   "options": "Subscription", 
+   "no_copy": 0, 
+   "options": "Physician", 
    "permlevel": 0, 
-   "print_hide": 1, 
+   "precision": "", 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "reminded", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reminded", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -686,21 +751,21 @@
  "idx": 0, 
  "image_view": 0, 
  "in_create": 0, 
- "is_submittable": 1, 
+ "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-08-31 13:27:39.208298", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
- "name": "Subscription", 
+ "module": "Healthcare", 
+ "name": "Patient Appointment", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
-   "cancel": 1, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
@@ -711,21 +776,42 @@
    "print": 1, 
    "read": 1, 
    "report": 1, 
-   "role": "System Manager", 
+   "role": "Healthcare Administrator", 
    "set_user_permissions": 0, 
    "share": 1, 
-   "submit": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
   }
  ], 
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "reference_document", 
- "show_name_in_global_search": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient, physician, appointment_datetime,department", 
+ "show_name_in_global_search": 1, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "reference_document", 
+ "title_field": "patient", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
new file mode 100755
index 0000000..eab2f2d
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
@@ -0,0 +1,244 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+import json
+from frappe.utils import getdate
+from frappe import _
+import datetime
+from frappe.core.doctype.sms_settings.sms_settings import send_sms
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account
+
+class PatientAppointment(Document):
+	def on_update(self):
+		today = datetime.date.today()
+		appointment_date = getdate(self.appointment_date)
+		#If appointment created for today set as open
+		if(today == appointment_date):
+			frappe.db.set_value("Patient Appointment",self.name,"status","Open")
+			self.reload()
+
+	def after_insert(self):
+		#Check fee validity exists
+		appointment = self
+		validity_exist = validity_exists(appointment.physician, appointment.patient)
+		if validity_exist :
+			fee_validity = frappe.get_doc("Fee Validity",validity_exist[0][0])
+			#Check if the validity is valid
+			appointment_date = getdate(appointment.appointment_date)
+			if((fee_validity.valid_till >= appointment_date) and (fee_validity.visited < fee_validity.max_visit)):
+				visited = fee_validity.visited + 1
+				frappe.db.set_value("Fee Validity",fee_validity.name,"visited",visited)
+				if(fee_validity.ref_invoice):
+					frappe.db.set_value("Patient Appointment",appointment.name,"sales_invoice",fee_validity.ref_invoice)
+				frappe.msgprint(_("{0} has fee validity till {1}").format(appointment.patient, fee_validity.valid_till))
+		confirm_sms(self)
+
+def appointment_cancel(appointmentId):
+	appointment = frappe.get_doc("Patient Appointment",appointmentId)
+	#If invoice --> fee_validity update with -1 visit
+	if (appointment.sales_invoice):
+ 		validity = frappe.db.exists({"doctype": "Fee Validity","ref_invoice": appointment.sales_invoice})
+ 		if(validity):
+ 			fee_validity = frappe.get_doc("Fee Validity",validity[0][0])
+ 			visited = fee_validity.visited - 1
+ 			frappe.db.set_value("Fee Validity",fee_validity.name,"visited",visited)
+ 			if visited <= 0:
+ 				frappe.msgprint(_("Appointment cancelled, Please review and cancel the invoice {0}".format(appointment.sales_invoice)))
+ 			else:
+ 				frappe.msgprint(_("Appointment cancelled"))
+
+@frappe.whitelist()
+def get_availability_data(date, physician):
+	# get availability data of 'physician' on 'date'
+	date = getdate(date)
+	weekday = date.strftime("%A")
+
+	available_slots = []
+	# get physicians schedule
+	physician_schedule_name = frappe.db.get_value("Physician", physician, "physician_schedule")
+	physician_schedule = frappe.get_doc("Physician Schedule", physician_schedule_name)
+	time_per_appointment = frappe.db.get_value("Physician", physician, "time_per_appointment")
+
+	for t in physician_schedule.time_slots:
+		if weekday == t.day:
+			available_slots.append(t)
+
+	# if physician not available return
+	if not available_slots:
+		# TODO: return available slots in nearby dates
+		frappe.throw(_("Physician not available on {0}").format(weekday))
+
+	# if physician on leave return
+
+	# if holiday return
+	# if is_holiday(weekday):
+
+	# get appointments on that day for physician
+	appointments = frappe.get_all(
+		"Patient Appointment",
+		filters={"physician": physician, "appointment_date": date},
+		fields=["name", "appointment_time", "duration", "status"])
+
+	return {
+		"available_slots": available_slots,
+		"appointments": appointments,
+		"time_per_appointment": time_per_appointment
+	}
+
+@frappe.whitelist()
+def update_status(appointmentId, status):
+	frappe.db.set_value("Patient Appointment",appointmentId,"status",status)
+	if(status=="Cancelled"):
+		appointment_cancel(appointmentId)
+
+@frappe.whitelist()
+def set_open_appointments():
+	today = getdate()
+	frappe.db.sql("""update `tabPatient Appointment` set status='Open' where status = 'Scheduled' and appointment_date = %s""",(today))
+
+@frappe.whitelist()
+def set_pending_appointments():
+	today = getdate()
+	frappe.db.sql("""update `tabPatient Appointment` set status='Pending' where status in ('Scheduled','Open') and appointment_date < %s""",(today))
+
+def confirm_sms(doc):
+	if (frappe.db.get_value("Healthcare Settings", None, "app_con")=='1'):
+		message = frappe.db.get_value("Healthcare Settings", None, "app_con_msg")
+		send_message(doc, message)
+
+@frappe.whitelist()
+def create_invoice(company, physician, patient, appointment_id, appointment_date):
+	if not appointment_id:
+		return False
+	sales_invoice = frappe.new_doc("Sales Invoice")
+	sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
+	sales_invoice.appointment = appointment_id
+	sales_invoice.due_date = getdate()
+	sales_invoice.is_pos = '0'
+	sales_invoice.debit_to = get_receivable_account(company)
+
+	fee_validity = get_fee_validity(physician, patient, appointment_date)
+	create_invoice_items(appointment_id, physician, company, sales_invoice)
+
+	sales_invoice.save(ignore_permissions=True)
+	frappe.db.sql(_("""update `tabPatient Appointment` set sales_invoice='{0}' where name='{1}'""").format(sales_invoice.name, appointment_id))
+	frappe.db.set_value("Fee Validity", fee_validity.name, "ref_invoice", sales_invoice.name)
+	consultation = frappe.db.exists({
+			"doctype": "Consultation",
+			"appointment": appointment_id})
+	if consultation:
+		frappe.db.set_value("Consultation", consultation[0][0], "invoice", sales_invoice.name)
+	return sales_invoice.name
+
+def get_fee_validity(physician, patient, date):
+	validity_exist = validity_exists(physician, patient)
+	if validity_exist :
+		fee_validity = frappe.get_doc("Fee Validity",validity_exist[0][0])
+		fee_validity = update_fee_validity(fee_validity, date)
+	else:
+		fee_validity = create_fee_validity(physician, patient, date)
+	return fee_validity
+
+def validity_exists(physician, patient):
+	return frappe.db.exists({
+			"doctype": "Fee Validity",
+			"physician": physician,
+			"patient": patient})
+
+def update_fee_validity(fee_validity, date):
+	max_visit = frappe.db.get_value("Healthcare Settings", None, "max_visit")
+	valid_days = frappe.db.get_value("Healthcare Settings", None, "valid_days")
+	if not valid_days:
+		valid_days = 1
+	if not max_visit:
+		max_visit = 1
+	date = getdate(date)
+	valid_till = date + datetime.timedelta(days=int(valid_days))
+	fee_validity.max_visit = max_visit
+	fee_validity.visited = 1
+	fee_validity.valid_till = valid_till
+	fee_validity.save(ignore_permissions=True)
+	return fee_validity
+
+def create_fee_validity(physician, patient, date):
+	fee_validity = frappe.new_doc("Fee Validity")
+	fee_validity.physician = physician
+	fee_validity.patient = patient
+	fee_validity = update_fee_validity(fee_validity, date)
+	return fee_validity
+
+def create_invoice_items(appointment_id, physician, company, invoice):
+	item_line = invoice.append("items")
+	item_line.item_name = "Consulting Charges"
+	item_line.description = "Consulting Charges:  " + physician
+	item_line.qty = 1
+	item_line.uom = "Nos"
+	item_line.conversion_factor = 1
+	item_line.income_account = get_income_account(physician,company)
+	op_consulting_charge = frappe.db.get_value("Physician", physician, "op_consulting_charge")
+	if op_consulting_charge:
+		item_line.rate = op_consulting_charge
+		item_line.amount = op_consulting_charge
+	return invoice
+
+@frappe.whitelist()
+def create_consultation(appointment):
+	appointment = frappe.get_doc("Patient Appointment",appointment)
+	consultation = frappe.new_doc("Consultation")
+	consultation.appointment = appointment.name
+	consultation.patient = appointment.patient
+	consultation.physician = appointment.physician
+	consultation.visit_department = appointment.department
+	consultation.patient_sex = appointment.patient_sex
+	consultation.consultation_date = appointment.appointment_date
+	if appointment.sales_invoice:
+		consultation.invoice = appointment.sales_invoice
+	return consultation.as_dict()
+
+def remind_appointment():
+	if (frappe.db.get_value("Healthcare Settings", None, "app_rem")=='1'):
+		rem_before = datetime.datetime.strptime(frappe.get_value("Healthcare Settings", None, "rem_before"), "%H:%M:%S")
+		rem_dt = datetime.datetime.now() + datetime.timedelta(hours = rem_before.hour, minutes=rem_before.minute, seconds= rem_before.second)
+
+		appointment_list = frappe.db.sql("select name from `tabPatient Appointment` where start_dt between %s and %s and reminded = 0 ", (datetime.datetime.now(), rem_dt))
+
+		for i in range (0,len(appointment_list)):
+			doc = frappe.get_doc("Patient Appointment", appointment_list[i][0])
+			message = frappe.db.get_value("Healthcare Settings", None, "app_rem_msg")
+			send_message(doc, message)
+			frappe.db.set_value("Patient Appointment",doc.name,"reminded",1)
+
+def send_message(doc, message):
+	patient = frappe.get_doc("Patient",doc.patient)
+	if(patient.mobile):
+		context = {"doc": doc, "alert": doc, "comments": None}
+		if doc.get("_comments"):
+			context["comments"] = json.loads(doc.get("_comments"))
+		#jinja to string convertion happens here
+		message = frappe.render_template(message, context)
+		number = [patient.mobile]
+		send_sms(number,message)
+
+@frappe.whitelist()
+def get_events(start, end, filters=None):
+	"""Returns events for Gantt / Calendar view rendering.
+
+	:param start: Start date-time.
+	:param end: End date-time.
+	:param filters: Filters (JSON).
+	"""
+	from frappe.desk.calendar import get_event_conditions
+	conditions = get_event_conditions("Patient Appointment", filters)
+	data = frappe.db.sql("""select name, patient, physician, status,
+		duration, timestamp(appointment_date, appointment_time) as
+		'start' from `tabPatient Appointment` where
+		(appointment_date between %(start)s and %(end)s)
+		and docstatus < 2 {conditions}""".format(conditions=conditions),
+		{"start": start, "end": end}, as_dict=True, update={"allDay": 0})
+	for item in data:
+		item.end = item.start + datetime.timedelta(minutes = item.duration)
+	return data
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
new file mode 100644
index 0000000..bfb53b8
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_calendar.js
@@ -0,0 +1,44 @@
+
+frappe.views.calendar["Patient Appointment"] = {
+	field_map: {
+		"start": "start",
+		"end": "end",
+		"id": "name",
+		"title": "patient",
+		"allDay": "allDay"
+	},
+	gantt: true,
+	get_events_method: "erpnext.healthcare.doctype.patient_appointment.patient_appointment.get_events",
+	filters: [
+		{
+			'fieldtype': 'Link',
+			'fieldname': 'physician',
+			'options': 'Physician',
+			'label': __('Physician')
+		},
+		{
+			'fieldtype': 'Link',
+			'fieldname': 'patient',
+			'options': 'Patient',
+			'label': __('Patient')
+		},
+		{
+			'fieldtype': 'Link',
+			'fieldname': 'appointment_type',
+			'options': 'Appointment Type',
+			'label': __('Appointment Type')
+		},
+		{
+			'fieldtype': 'Link',
+			'fieldname': 'department',
+			'options': 'Medical Department',
+			'label': __('Department')
+		},
+		{
+			'fieldtype': 'Select',
+			'fieldname': 'status',
+			'options': 'Scheduled\nOpen\nClosed\nPending',
+			'label': __('Status')
+		}
+	]
+};
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
new file mode 100644
index 0000000..1862915
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
@@ -0,0 +1,19 @@
+from frappe import _
+
+def get_data():
+	return {
+		'fieldname': 'appointment',
+		'non_standard_fieldnames': {
+			'Patient Medical Record': 'reference_name'
+		},
+		'transactions': [
+			{
+				'label': _('Consultations'),
+				'items': ['Consultation', 'Vital Signs', 'Patient Medical Record']
+			},
+			{
+				'label': _('Billing'),
+				'items': ['Sales Invoice']
+			}
+		]
+	}
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_list.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_list.js
new file mode 100644
index 0000000..701cb69
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_list.js
@@ -0,0 +1,6 @@
+/*
+(c) ESS 2015-16
+*/
+frappe.listview_settings['Patient Appointment'] = {
+	filters: [["status", "=", "Open"]],
+};
diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.js b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.js
new file mode 100644
index 0000000..71fc177
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Patient Appointment", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Patient Appointment
+		() => frappe.tests.make('Patient Appointment', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
new file mode 100644
index 0000000..3536a5f
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Patient Appointment')
+
+class TestPatientAppointment(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/patient_medical_record/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/patient_medical_record/__init__.py
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.js b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.js
new file mode 100644
index 0000000..93ff70e
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Patient Medical Record', {
+});
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
new file mode 100644
index 0000000..0614923
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
@@ -0,0 +1,430 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "autoname": "naming_series:", 
+ "beta": 1, 
+ "creation": "2016-06-09 11:30:44.972056", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Series", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "PMR-", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Patient", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "attach", 
+   "fieldtype": "Attach", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_4", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "subject", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Subject", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Open\nClose", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Today", 
+   "fieldname": "communication_date", 
+   "fieldtype": "Date", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Datetime", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reference_doctype", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reference DocType", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "DocType", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reference_name", 
+   "fieldtype": "Dynamic Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reference Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "reference_doctype", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reference_owner", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reference Owner", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "reference_name.owner", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "__user", 
+   "fieldname": "user", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "User", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 1, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-09-04 14:29:48.679751", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Patient Medical Record", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient, subject, communication_date, reference_doctype, reference_name", 
+ "show_name_in_global_search": 1, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 1
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
new file mode 100644
index 0000000..35e42bd
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class PatientMedicalRecord(Document):
+	def after_insert(self):
+		if self.reference_doctype == "Patient Medical Record" :
+			frappe.db.set_value("Patient Medical Record", self.name, "reference_name", self.name)
diff --git a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.js b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.js
new file mode 100644
index 0000000..66dda09
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Patient Medical Record", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Patient Medical Record
+		() => frappe.tests.make('Patient Medical Record', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
new file mode 100644
index 0000000..460774a
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Patient Medical Record')
+
+class TestPatientMedicalRecord(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/patient_relation/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/patient_relation/__init__.py
diff --git a/erpnext/healthcare/doctype/patient_relation/patient_relation.json b/erpnext/healthcare/doctype/patient_relation/patient_relation.json
new file mode 100644
index 0000000..e97e1b2
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_relation/patient_relation.json
@@ -0,0 +1,134 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-04-26 15:40:11.561855", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "relation", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Relation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nFather\nMother\nSpouse\nSiblings\nFamily", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Patient", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Patient", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:13:37.497114", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Patient Relation", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/patient_relation/patient_relation.py b/erpnext/healthcare/doctype/patient_relation/patient_relation.py
new file mode 100644
index 0000000..150b962
--- /dev/null
+++ b/erpnext/healthcare/doctype/patient_relation/patient_relation.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class PatientRelation(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/physician/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/physician/__init__.py
diff --git a/erpnext/healthcare/doctype/physician/physician.js b/erpnext/healthcare/doctype/physician/physician.js
new file mode 100755
index 0000000..37389fe
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician/physician.js
@@ -0,0 +1,73 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Physician', {
+	setup: function(frm) {
+		frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
+			var d	= locals[cdt][cdn];
+			return {
+				filters: {
+					'root_type': 'Income',
+					'company': d.company,
+				}
+			};
+		});
+	},
+	refresh: function(frm) {
+		frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Physician'};
+		if(!frm.is_new()) {
+			frappe.contacts.render_address_and_contact(frm);
+		}
+	}
+});
+
+frappe.ui.form.on("Physician", "user_id",function(frm) {
+	if(frm.doc.user_id){
+		frappe.call({
+			"method": "frappe.client.get",
+			args: {
+				doctype: "User",
+				name: frm.doc.user_id
+			},
+			callback: function (data) {
+				if(!frm.doc.employee){
+					frappe.model.get_value('Employee', {'user_id': frm.doc.user_id}, 'name',
+						function(data) {
+							if(data)
+								frappe.model.set_value(frm.doctype,frm.docname, "employee", data.name);
+						});
+				}
+				if(!frm.doc.first_name)
+					frappe.model.set_value(frm.doctype,frm.docname, "first_name", data.message.first_name);
+				if(!frm.doc.middle_name)
+					frappe.model.set_value(frm.doctype,frm.docname, "middle_name", data.message.middle_name);
+				if(!frm.doc.last_name)
+					frappe.model.set_value(frm.doctype,frm.docname, "last_name", data.message.last_name);
+				if(!frm.doc.mobile_phone)
+					frappe.model.set_value(frm.doctype,frm.docname, "mobile_phone", data.message.phone);
+			}
+		});
+	}
+});
+
+frappe.ui.form.on("Physician", "employee", function(frm) {
+	if(frm.doc.employee){
+		frappe.call({
+			"method": "frappe.client.get",
+			args: {
+				doctype: "Employee",
+				name: frm.doc.employee
+			},
+			callback: function (data) {
+				if(!frm.doc.designation)
+					frappe.model.set_value(frm.doctype,frm.docname, "designation", data.message.designation);
+				if(!frm.doc.first_name)
+					frappe.model.set_value(frm.doctype,frm.docname, "first_name", data.message.employee_name);
+				if(!frm.doc.mobile_phone)
+					frappe.model.set_value(frm.doctype,frm.docname, "mobile_phone", data.message.cell_number);
+				if(!frm.doc.address)
+					frappe.model.set_value(frm.doctype,frm.docname, "address", data.message.current_address);
+			}
+		});
+	}
+});
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/healthcare/doctype/physician/physician.json
similarity index 68%
copy from erpnext/subscription/doctype/subscription/subscription.json
copy to erpnext/healthcare/doctype/physician/physician.json
index 6cfee1e..565653b 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/healthcare/doctype/physician/physician.json
@@ -1,17 +1,16 @@
 {
- "allow_copy": 0, 
+ "allow_copy": 1, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
  "allow_rename": 1, 
- "autoname": "naming_series:", 
- "beta": 0, 
- "creation": "2017-07-18 17:50:43.967266", 
+ "autoname": "", 
+ "beta": 1, 
+ "creation": "2016-02-23 11:20:53.565119", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
- "document_type": "", 
- "editable_grid": 1, 
- "engine": "InnoDB", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_bulk_edit": 0, 
@@ -19,8 +18,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_1", 
-   "fieldtype": "Section Break", 
+   "fieldname": "first_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "First Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "middle_name", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -28,6 +57,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
+   "label": "Middle Name (Optional)", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -48,19 +78,18 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
+   "fieldname": "last_name", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Series", 
+   "label": "Last Name", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "SUB-", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -79,233 +108,53 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_doctype", 
+   "fieldname": "image", 
+   "fieldtype": "Attach Image", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "employee", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Reference Doctype", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "DocType", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_document", 
-   "fieldtype": "Dynamic Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Document", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "reference_doctype", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disabled", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Disabled", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "submit_on_creation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Submit on Creation", 
+   "label": "Employee", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Employee", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_5", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "start_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Start Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "End Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "next_schedule_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Next Schedule Date", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
@@ -320,8 +169,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency_detail", 
-   "fieldtype": "Section Break", 
+   "fieldname": "user_id", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -329,9 +178,10 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
+   "label": "User", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "User", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -350,8 +200,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
+   "fieldname": "designation", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -359,10 +209,10 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Frequency", 
+   "label": "Designation", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDaily\nWeekly\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
+   "options": "Designation", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -370,7 +220,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -381,7 +231,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_12", 
+   "fieldname": "department", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Department", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Medical Department", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_7", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -406,13 +287,12 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval: in_list([\"Monthly\", \"Quarterly\", \"Yearly\"], doc.frequency)", 
-   "fieldname": "repeat_on_day", 
-   "fieldtype": "Int", 
+   "fieldname": "hospital", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -420,7 +300,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Repeat on Day", 
+   "label": "Hospital", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -441,7 +321,97 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "notification", 
+   "fieldname": "mobile_phone", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Mobile", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "residence_phone", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Phone (R)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "office_phone", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Phone (Office)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "appointments", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -450,7 +420,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Notification", 
+   "label": "Appointments", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -468,11 +438,11 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "notify_by_email", 
-   "fieldtype": "Check", 
+   "fieldname": "physician_schedule", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -480,9 +450,10 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Notify by Email", 
+   "label": "Physician Schedule", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Physician Schedule", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -530,9 +501,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "recipients", 
-   "fieldtype": "Small Text", 
+   "fieldname": "time_per_appointment", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -540,7 +510,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Recipients", 
+   "label": "Time per Appointment", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -561,39 +531,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "print_format", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Print Format", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Print Format", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "columns": 0, 
-   "fieldname": "section_break_16", 
+   "fieldname": "charges", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -602,7 +540,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
+   "label": "Charges", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -623,25 +561,24 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
+   "fieldname": "op_consulting_charge", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Status", 
+   "label": "OP Consulting Charge", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
+   "options": "Currency", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -655,8 +592,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "amended_from", 
-   "fieldtype": "Link", 
+   "fieldname": "contacts_and_address", 
+   "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -664,14 +601,195 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Amended From", 
+   "label": "Contacts and Address", 
    "length": 0, 
-   "no_copy": 1, 
-   "options": "Subscription", 
+   "no_copy": 0, 
    "permlevel": 0, 
-   "print_hide": 1, 
+   "precision": "", 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "address_html", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Address HTML", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_19", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "contact_html", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Contact HTML", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "account_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Account Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "accounts", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Party Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "default_currency", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Default Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -684,23 +802,44 @@
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "idx": 0, 
+ "image_field": "image", 
  "image_view": 0, 
  "in_create": 0, 
- "is_submittable": 1, 
+ "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-08-31 13:51:28.975120", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
- "name": "Subscription", 
+ "module": "Healthcare", 
+ "name": "Physician", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
   {
    "amend": 0, 
    "apply_user_permissions": 0, 
-   "cancel": 1, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
@@ -711,21 +850,42 @@
    "print": 1, 
    "read": 1, 
    "report": 1, 
-   "role": "System Manager", 
+   "role": "Physician", 
    "set_user_permissions": 0, 
    "share": 1, 
-   "submit": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Nursing User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
   }
  ], 
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "reference_document", 
- "show_name_in_global_search": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "first_name,mobile_phone,office_phone", 
+ "show_name_in_global_search": 1, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "reference_document", 
+ "title_field": "first_name", 
  "track_changes": 1, 
  "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/physician/physician.py b/erpnext/healthcare/doctype/physician/physician.py
new file mode 100644
index 0000000..8680d5d
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician/physician.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+from frappe import throw, _
+from frappe.utils import cstr
+from erpnext.accounts.party import validate_party_accounts
+from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
+class Physician(Document):
+	def onload(self):
+		load_address_and_contact(self)
+
+	def autoname(self):
+		# physician first_name and last_name
+		self.name = " ".join(filter(None,
+			[cstr(self.get(f)).strip() for f in ["first_name","middle_name","last_name"]]))
+
+	def validate(self):
+		validate_party_accounts(self)
+		if self.user_id:
+			self.validate_for_enabled_user_id()
+			self.validate_duplicate_user_id()
+			existing_user_id = frappe.db.get_value("Physician", self.name, "user_id")
+			if(self.user_id != existing_user_id):
+				frappe.permissions.remove_user_permission(
+					"Physician", self.name, existing_user_id)
+
+
+		else:
+			existing_user_id = frappe.db.get_value("Physician", self.name, "user_id")
+			if existing_user_id:
+				frappe.permissions.remove_user_permission(
+					"Physician", self.name, existing_user_id)
+
+	def on_update(self):
+		if self.user_id:
+			frappe.permissions.add_user_permission("Physician", self.name, self.user_id)
+
+
+	def validate_for_enabled_user_id(self):
+		enabled = frappe.db.get_value("User", self.user_id, "enabled")
+		if enabled is None:
+			frappe.throw(_("User {0} does not exist").format(self.user_id))
+		if enabled == 0:
+			frappe.throw(_("User {0} is disabled").format(self.user_id))
+
+	def validate_duplicate_user_id(self):
+		physician = frappe.db.sql_list("""select name from `tabPhysician` where
+			user_id=%s and name!=%s""", (self.user_id, self.name))
+		if physician:
+			throw(_("User {0} is already assigned to Physician {1}").format(
+				self.user_id, physician[0]), frappe.DuplicateEntryError)
+
+	def on_trash(self):
+		delete_contact_and_address('Physician', self.name)
diff --git a/erpnext/healthcare/doctype/physician/test_physician.js b/erpnext/healthcare/doctype/physician/test_physician.js
new file mode 100644
index 0000000..43750ac
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician/test_physician.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Physician", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Physician
+		() => frappe.tests.make('Physician', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/physician/test_physician.py b/erpnext/healthcare/doctype/physician/test_physician.py
new file mode 100644
index 0000000..b6ea92c
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician/test_physician.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Physician')
+
+class TestPhysician(unittest.TestCase):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/physician_schedule/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/physician_schedule/__init__.py
diff --git a/erpnext/healthcare/doctype/physician_schedule/physician_schedule.js b/erpnext/healthcare/doctype/physician_schedule/physician_schedule.js
new file mode 100644
index 0000000..e198d35
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule/physician_schedule.js
@@ -0,0 +1,59 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Physician Schedule', {
+	refresh: function(frm) {
+		frm.add_custom_button(__('Add Time Slots'), () => {
+			var d = new frappe.ui.Dialog({
+				fields: [
+					{fieldname: 'day', label: __('Day'), fieldtype:'Select',
+						options:[
+							{value:'Sunday', label:__('Sunday')},
+							{value:'Monday', label:__('Monday')},
+							{value:'Tuesday', label:__('Tuesday')},
+							{value:'Wednesday', label:__('Wednesday')},
+							{value:'Thursday', label:__('Thursday')},
+							{value:'Friday', label:__('Friday')},
+							{value:'Saturday', label:__('Saturday')},
+						], reqd: 1, 'default': 'Monday'},
+					{fieldname: 'from_time', label:__('From'), fieldtype:'Time',
+						'default': '09:00:00', reqd: 1},
+					{fieldname: 'to_time', label:__('To'), fieldtype:'Time',
+						'default': '12:00:00', reqd: 1},
+					{fieldname: 'duration', label:__('Appointment Duration (mins)'),
+						fieldtype:'Int', 'default': 15, reqd: 1},
+				],
+				primary_action_label: __('Add Timeslots'),
+				primary_action: () => {
+					var values = d.get_values();
+					if(values) {
+						let cur_time = moment(values.from_time, 'HH:mm:ss');
+						let end_time = moment(values.to_time, 'HH:mm:ss');
+
+
+						while(cur_time < end_time) {
+							let to_time = cur_time.clone().add(values.duration, 'minutes');
+							if(to_time < end_time) {
+
+								// add a new timeslot
+								frm.add_child('time_slots', {
+									from_time: cur_time.format('HH:mm:ss'),
+									to_time: to_time.format('HH:mm:ss'),
+									day: values.day
+								});
+							}
+							cur_time = to_time;
+						}
+
+						frm.refresh_field('time_slots');
+						frappe.show_alert({
+							message:__('Time slots added'),
+							indicator:'green'
+						});
+					}
+				},
+			});
+			d.show();
+		});
+	}
+});
diff --git a/erpnext/healthcare/doctype/physician_schedule/physician_schedule.json b/erpnext/healthcare/doctype/physician_schedule/physician_schedule.json
new file mode 100644
index 0000000..bd8e539
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule/physician_schedule.json
@@ -0,0 +1,155 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:schedule_name", 
+ "beta": 1, 
+ "creation": "2017-05-03 17:28:03.926787", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "schedule_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Schedule Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "time_slots", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Time Slots", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Physician Schedule Time Slot", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "disabled", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Disabled", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:42:26.713507", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Physician Schedule", 
+ "name_case": "", 
+ "owner": "rmehta@gmail.com", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 1, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/physician_schedule/physician_schedule.py b/erpnext/healthcare/doctype/physician_schedule/physician_schedule.py
new file mode 100644
index 0000000..5cbdd12
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule/physician_schedule.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class PhysicianSchedule(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/physician_schedule/test_physician_schedule.js b/erpnext/healthcare/doctype/physician_schedule/test_physician_schedule.js
new file mode 100644
index 0000000..c397f18
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule/test_physician_schedule.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Physician Schedule", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Physician Schedule
+		() => frappe.tests.make('Physician Schedule', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/physician_schedule/test_physician_schedule.py b/erpnext/healthcare/doctype/physician_schedule/test_physician_schedule.py
new file mode 100644
index 0000000..ece3578
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule/test_physician_schedule.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestPhysicianSchedule(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/physician_schedule_time_slot/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/physician_schedule_time_slot/__init__.py
diff --git a/erpnext/healthcare/doctype/physician_schedule_time_slot/physician_schedule_time_slot.json b/erpnext/healthcare/doctype/physician_schedule_time_slot/physician_schedule_time_slot.json
new file mode 100644
index 0000000..8aece2b
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule_time_slot/physician_schedule_time_slot.json
@@ -0,0 +1,133 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-05-03 17:27:07.466088", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "day", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Day", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "from_time", 
+   "fieldtype": "Time", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "From Time", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "to_time", 
+   "fieldtype": "Time", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "To Time", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-07-12 14:28:01.985998", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Physician Schedule Time Slot", 
+ "name_case": "", 
+ "owner": "rmehta@gmail.com", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/physician_schedule_time_slot/physician_schedule_time_slot.py b/erpnext/healthcare/doctype/physician_schedule_time_slot/physician_schedule_time_slot.py
new file mode 100644
index 0000000..abdce51
--- /dev/null
+++ b/erpnext/healthcare/doctype/physician_schedule_time_slot/physician_schedule_time_slot.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class PhysicianScheduleTimeSlot(Document):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/prescription_dosage/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/prescription_dosage/__init__.py
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.js b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.js
new file mode 100644
index 0000000..94b444c
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Prescription Dosage', {
+});
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.json b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.json
new file mode 100644
index 0000000..9c09506
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.json
@@ -0,0 +1,145 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:dosage", 
+ "beta": 1, 
+ "creation": "2016-09-16 15:49:25.327610", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "dosage", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Dosage", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "dosage_strength", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Dosage Strength", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:42:40.305284", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Prescription Dosage", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "dosage", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
new file mode 100644
index 0000000..dea263d
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class PrescriptionDosage(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.js b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.js
new file mode 100644
index 0000000..009614f
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Prescription Dosage", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Prescription Dosage
+		() => frappe.tests.make('Prescription Dosage', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
new file mode 100644
index 0000000..e61a418
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestPrescriptionDosage(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/prescription_duration/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/prescription_duration/__init__.py
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.js b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.js
new file mode 100644
index 0000000..dd5887c
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Prescription Duration', {
+});
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.json b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.json
new file mode 100644
index 0000000..c4f6c5f
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.json
@@ -0,0 +1,145 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "", 
+ "beta": 1, 
+ "creation": "2016-09-16 15:50:28.895789", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "number", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Number", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "period", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Period", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Hour\nDay\nWeek\nMonth", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:42:51.325725", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Prescription Duration", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "", 
+ "sort_order": "ASC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
new file mode 100644
index 0000000..96ddf8d
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+from frappe.utils import cstr
+
+class PrescriptionDuration(Document):
+	def autoname(self):
+		self.name = " ".join(filter(None,
+			[cstr(self.get(f)).strip() for f in ["number", "period"]]))
+	def get_days(self):
+		days = 0
+		duration = self
+		if(duration.period == 'Day'):
+			days = duration.number
+		if(duration.period == 'Hour'):
+			days = (duration.number)/24
+		if(duration.period == 'Week'):
+			days = (duration.number*7)
+		if(duration.period == 'Month'):
+			days = (duration.number*30)
+		return days
+	def get_weeks(self):
+		weeks = 0
+		duration = self
+		if(duration.period == 'Day'):
+			weeks = (duration.number)/7
+		#if(duration.period == 'Hour'):
+		#	weeks = (duration.number)/x
+		if(duration.period == 'Week'):
+			weeks = duration.number
+		if(duration.period == 'Month'):
+			weeks = duration.number*4
+		return weeks
+	def get_months(self):
+		months = 0
+		duration = self
+		if(duration.period == 'Day'):
+			months = (duration.number)/30
+		#if(duration.period == 'Hour'):
+		#	months = (duration.number)/x
+		if(duration.period == 'Week'):
+			months = (duration.number)/4
+		if(duration.period == 'Month'):
+			months = duration.number
+		return months
+	def get_hours(self):
+		hours = 0
+		duration = self
+		if(duration.period == 'Day'):
+			hours = (duration.number*24)
+		if(duration.period == 'Hour'):
+			hours = duration.number
+		if(duration.period == 'Week'):
+			hours = (duration.number*24)*7
+		if(duration.period == 'Month'):
+			hours = (duration.number*24)*30
+		return hours
+	def get_minutes(self):
+		minutes = 0
+		duration = self
+		if(duration.period == 'Day'):
+			minutes = (duration.number*1440)
+		if(duration.period == 'Hour'):
+			minutes = (duration.number*60)
+		if(duration.period == 'Week'):
+			minutes = (duration.number*10080)
+		if(duration.period == 'Month'):
+			minutes = (duration.number*43800)
+		return minutes
diff --git a/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.js b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.js
new file mode 100644
index 0000000..4971e79
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Prescription Duration", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Prescription Duration
+		() => frappe.tests.make('Prescription Duration', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
new file mode 100644
index 0000000..fe5524c
--- /dev/null
+++ b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+class TestPrescriptionDuration(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/sample_collection/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/sample_collection/__init__.py
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.js b/erpnext/healthcare/doctype/sample_collection/sample_collection.js
new file mode 100644
index 0000000..9934ce4
--- /dev/null
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.js
@@ -0,0 +1,40 @@
+// Copyright (c) 2016, ESS and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Sample Collection', {
+	refresh: function(frm) {
+		if(frappe.defaults.get_default("require_sample_collection")){
+			frm.add_custom_button(__("View Lab Tests"), function() {
+				frappe.route_options = {"sample": frm.doc.name};
+				frappe.set_route("List", "Lab Test");
+			});
+		}
+	}
+});
+
+frappe.ui.form.on("Sample Collection", "patient", function(frm) {
+	if(frm.doc.patient){
+		frappe.call({
+			"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
+			args: {
+				patient: frm.doc.patient
+			},
+			callback: function (data) {
+				var age = null;
+				if(data.message.dob){
+					age = calculate_age(data.message.dob);
+				}
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
+				frappe.model.set_value(frm.doctype,frm.docname, "patient_sex", data.message.sex);
+			}
+		});
+	}
+});
+
+var calculate_age = function(birth) {
+	var	ageMS = Date.parse(Date()) - Date.parse(birth);
+	var	age = new Date();
+	age.setTime(ageMS);
+	var	years =  age.getFullYear() - 1970;
+	return  years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
+};
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
similarity index 70%
copy from erpnext/subscription/doctype/subscription/subscription.json
copy to erpnext/healthcare/doctype/sample_collection/sample_collection.json
index 6cfee1e..ee2f83f 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
@@ -1,53 +1,25 @@
 {
- "allow_copy": 0, 
+ "allow_copy": 1, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
- "allow_rename": 1, 
+ "allow_rename": 0, 
  "autoname": "naming_series:", 
- "beta": 0, 
- "creation": "2017-07-18 17:50:43.967266", 
+ "beta": 1, 
+ "creation": "2016-04-05 15:58:18.076977", 
  "custom": 0, 
+ "default_print_format": "", 
  "docstatus": 0, 
  "doctype": "DocType", 
- "document_type": "", 
- "editable_grid": 1, 
- "engine": "InnoDB", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
  "fields": [
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_1", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
+   "default": "", 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -59,16 +31,16 @@
    "in_standard_filter": 0, 
    "label": "Series", 
    "length": 0, 
-   "no_copy": 0, 
-   "options": "SUB-", 
+   "no_copy": 1, 
+   "options": "SMPL-", 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -79,28 +51,28 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_doctype", 
+   "fieldname": "invoice", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
+   "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Doctype", 
+   "label": "Invoice", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "DocType", 
+   "options": "Sales Invoice", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
+   "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
    "set_only_once": 0, 
    "unique": 0
   }, 
@@ -110,8 +82,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_document", 
-   "fieldtype": "Dynamic Link", 
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -119,40 +91,10 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Document", 
+   "label": "Patient", 
    "length": 0, 
-   "no_copy": 1, 
-   "options": "reference_doctype", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disabled", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Disabled", 
-   "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
+   "options": "Patient", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -171,37 +113,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "submit_on_creation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Submit on Creation", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_5", 
+   "fieldname": "column_break_4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -230,68 +142,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "start_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Start Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "End Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "next_schedule_date", 
-   "fieldtype": "Date", 
+   "fieldname": "patient_age", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -299,14 +151,15 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Next Schedule Date", 
+   "label": "Age", 
    "length": 0, 
-   "no_copy": 1, 
+   "no_copy": 0, 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 1, 
+   "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -320,7 +173,69 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency_detail", 
+   "fieldname": "patient_sex", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Gender", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "patient.sex", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_6", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -329,7 +244,6 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -350,8 +264,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
+   "fieldname": "sample", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -359,10 +273,10 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Frequency", 
+   "label": "Sample", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDaily\nWeekly\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
+   "options": "Lab Test Sample", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -371,6 +285,37 @@
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample_uom", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "sample.sample_uom", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -381,7 +326,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_12", 
+   "default": "0", 
+   "fieldname": "sample_quantity", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_10", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -406,12 +382,73 @@
   }, 
   {
    "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "collected_by", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Collected By", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "collected_time", 
+   "fieldtype": "Datetime", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Collected Time", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval: in_list([\"Monthly\", \"Quarterly\", \"Yearly\"], doc.frequency)", 
-   "fieldname": "repeat_on_day", 
+   "default": "1", 
+   "fieldname": "num_print", 
    "fieldtype": "Int", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -420,12 +457,12 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Repeat on Day", 
+   "label": "No. of print", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "remember_last_selected_value": 0, 
@@ -441,220 +478,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "notification", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Notification", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "notify_by_email", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Notify by Email", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_17", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "recipients", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Recipients", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "print_format", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Print Format", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Print Format", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "columns": 0, 
-   "fieldname": "section_break_16", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Status", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -667,7 +490,7 @@
    "label": "Amended From", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Subscription", 
+   "options": "Sample Collection", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -678,6 +501,65 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_15", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sample_collection_details", 
+   "fieldtype": "Long Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Collection Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 0, 
@@ -690,19 +572,19 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-08-31 13:30:29.303026", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
- "name": "Subscription", 
+ "module": "Healthcare", 
+ "name": "Sample Collection", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0, 
+   "amend": 1, 
    "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
-   "delete": 1, 
+   "delete": 0, 
    "email": 1, 
    "export": 1, 
    "if_owner": 0, 
@@ -711,7 +593,7 @@
    "print": 1, 
    "read": 1, 
    "report": 1, 
-   "role": "System Manager", 
+   "role": "Laboratory User", 
    "set_user_permissions": 0, 
    "share": 1, 
    "submit": 1, 
@@ -721,11 +603,12 @@
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "reference_document", 
- "show_name_in_global_search": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient, sample", 
+ "show_name_in_global_search": 1, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "reference_document", 
+ "title_field": "patient", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.py b/erpnext/healthcare/doctype/sample_collection/sample_collection.py
new file mode 100644
index 0000000..2c64320
--- /dev/null
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class SampleCollection(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/sample_collection/test_sample_collection.js b/erpnext/healthcare/doctype/sample_collection/test_sample_collection.js
new file mode 100644
index 0000000..2b4aed7
--- /dev/null
+++ b/erpnext/healthcare/doctype/sample_collection/test_sample_collection.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Sample Collection", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Sample Collection
+		() => frappe.tests.make('Sample Collection', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/sample_collection/test_sample_collection.py b/erpnext/healthcare/doctype/sample_collection/test_sample_collection.py
new file mode 100644
index 0000000..0b16173
--- /dev/null
+++ b/erpnext/healthcare/doctype/sample_collection/test_sample_collection.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+# test_records = frappe.get_test_records('Sample Collection')
+
+class TestSampleCollection(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/sensitivity/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/sensitivity/__init__.py
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.js b/erpnext/healthcare/doctype/sensitivity/sensitivity.js
new file mode 100644
index 0000000..f9c9002
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity/sensitivity.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Sensitivity', {
+});
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.json b/erpnext/healthcare/doctype/sensitivity/sensitivity.json
new file mode 100644
index 0000000..620f37a
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity/sensitivity.json
@@ -0,0 +1,115 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:sensitivity", 
+ "beta": 1, 
+ "creation": "2016-02-23 11:12:54.623249", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 0, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "sensitivity", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Sensitivity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:44:07.147326", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Sensitivity", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Laboratory User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 0
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Healthcare Administrator", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "sensitivity", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "sensitivity", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.py b/erpnext/healthcare/doctype/sensitivity/sensitivity.py
new file mode 100644
index 0000000..bf7c36b
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity/sensitivity.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class Sensitivity(Document):
+	pass
diff --git a/erpnext/healthcare/doctype/sensitivity/test_sensitivity.js b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.js
new file mode 100644
index 0000000..c2cf406
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Sensitivity", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Sensitivity
+		() => frappe.tests.make('Sensitivity', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
new file mode 100644
index 0000000..1616d2d
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Sensitivity')
+
+class TestSensitivity(unittest.TestCase):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/sensitivity_test_items/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/sensitivity_test_items/__init__.py
diff --git a/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.json b/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.json
new file mode 100644
index 0000000..e656b51
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.json
@@ -0,0 +1,103 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-02-22 15:18:01.769903", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 1, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "antibiotic", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Antibiotic", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Antibiotic", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "antibiotic_sensitivity", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Sensitivity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Sensitivity", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 13:46:40.609983", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Sensitivity Test Items", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.py b/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.py
new file mode 100644
index 0000000..35c8efd
--- /dev/null
+++ b/erpnext/healthcare/doctype/sensitivity_test_items/sensitivity_test_items.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class SensitivityTestItems(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/special_test_items/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/special_test_items/__init__.py
diff --git a/erpnext/healthcare/doctype/special_test_items/special_test_items.json b/erpnext/healthcare/doctype/special_test_items/special_test_items.json
new file mode 100644
index 0000000..89545e9
--- /dev/null
+++ b/erpnext/healthcare/doctype/special_test_items/special_test_items.json
@@ -0,0 +1,166 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-02-22 15:12:36.202380", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "test_particulars", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Particulars", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval:doc.require_result_value == 1", 
+   "fieldname": "result_value", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Value", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "", 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": ""
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "require_result_value", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Require Result Value", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "template", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Template", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Lab Test Template", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:12:12.623714", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Special Test Items", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/special_test_items/special_test_items.py b/erpnext/healthcare/doctype/special_test_items/special_test_items.py
new file mode 100644
index 0000000..17080b7
--- /dev/null
+++ b/erpnext/healthcare/doctype/special_test_items/special_test_items.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class SpecialTestItems(Document):
+	pass
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/healthcare/doctype/special_test_template/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/healthcare/doctype/special_test_template/__init__.py
diff --git a/erpnext/healthcare/doctype/special_test_template/special_test_template.json b/erpnext/healthcare/doctype/special_test_template/special_test_template.json
new file mode 100644
index 0000000..83f3cb6
--- /dev/null
+++ b/erpnext/healthcare/doctype/special_test_template/special_test_template.json
@@ -0,0 +1,72 @@
+{
+ "allow_copy": 1, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2016-02-22 16:12:12.394200", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Setup", 
+ "editable_grid": 1, 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "particulars", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Result Component", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-31 14:08:18.833796", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Special Test Template", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/special_test_template/special_test_template.py b/erpnext/healthcare/doctype/special_test_template/special_test_template.py
new file mode 100644
index 0000000..e4e0d5b
--- /dev/null
+++ b/erpnext/healthcare/doctype/special_test_template/special_test_template.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class SpecialTestTemplate(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/doctype/vital_signs/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/doctype/vital_signs/__init__.py
diff --git a/erpnext/healthcare/doctype/vital_signs/test_vital_signs.js b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.js
new file mode 100644
index 0000000..f4ab446
--- /dev/null
+++ b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Vital Signs", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Vital Signs
+		() => frappe.tests.make('Vital Signs', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
new file mode 100644
index 0000000..5d3e007
--- /dev/null
+++ b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and Contributors
+# See license.txt
+from __future__ import unicode_literals
+import unittest
+
+# test_records = frappe.get_test_records('Vital Signs')
+
+class TestVitalSigns(unittest.TestCase):
+	pass
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.js b/erpnext/healthcare/doctype/vital_signs/vital_signs.js
new file mode 100644
index 0000000..a5f9d61
--- /dev/null
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.js
@@ -0,0 +1,49 @@
+// Copyright (c) 2016, ESS LLP and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on("Vital Signs", "height", function(frm) {
+	if(frm.doc.height && frm.doc.weight){
+		calculate_bmi(frm);
+	}
+});
+
+frappe.ui.form.on("Vital Signs", "weight", function(frm) {
+	if(frm.doc.height && frm.doc.weight){
+		calculate_bmi(frm);
+	}
+});
+
+var calculate_bmi = function(frm){
+	// Reference https://en.wikipedia.org/wiki/Body_mass_index
+	// bmi = weight (in Kg) / height * height (in Meter)
+	var bmi = (frm.doc.weight/(frm.doc.height*frm.doc.height)).toFixed(2);
+	var bmi_note = null;
+	if(bmi<18.5){
+		bmi_note = "Underweight";
+	}else if(bmi>=18.5 && bmi<25){
+		bmi_note = "Normal";
+	}else if(bmi>=25 && bmi<30){
+		bmi_note = "Overweight";
+	}else if(bmi>=30){
+		bmi_note = "Obese";
+	}
+	frappe.model.set_value(frm.doctype,frm.docname, "bmi", bmi);
+	frappe.model.set_value(frm.doctype,frm.docname, "nutrition_note", bmi_note);
+};
+
+frappe.ui.form.on("Vital Signs", "bp_systolic", function(frm) {
+	if(frm.doc.bp_systolic && frm.doc.bp_diastolic){
+		set_bp(frm);
+	}
+});
+
+frappe.ui.form.on("Vital Signs", "bp_diastolic", function(frm) {
+	if(frm.doc.bp_systolic && frm.doc.bp_diastolic){
+		set_bp(frm);
+	}
+});
+
+var set_bp = function(frm){
+	var bp = frm.doc.bp_systolic+"/"+frm.doc.bp_diastolic+" mmHg";
+	frappe.model.set_value(frm.doctype,frm.docname, "bp", bp);
+};
diff --git a/erpnext/subscription/doctype/subscription/subscription.json b/erpnext/healthcare/doctype/vital_signs/vital_signs.json
similarity index 74%
copy from erpnext/subscription/doctype/subscription/subscription.json
copy to erpnext/healthcare/doctype/vital_signs/vital_signs.json
index 6cfee1e..e44af28 100644
--- a/erpnext/subscription/doctype/subscription/subscription.json
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.json
@@ -1,11 +1,10 @@
 {
- "allow_copy": 0, 
+ "allow_copy": 1, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
- "allow_rename": 1, 
- "autoname": "naming_series:", 
- "beta": 0, 
- "creation": "2017-07-18 17:50:43.967266", 
+ "allow_rename": 0, 
+ "beta": 1, 
+ "creation": "2017-02-02 11:00:24.853005", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
@@ -19,67 +18,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_1", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Series", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "SUB-", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "reference_doctype", 
+   "fieldname": "patient", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -88,10 +27,10 @@
    "in_global_search": 0, 
    "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Reference Doctype", 
+   "label": "Patient", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "DocType", 
+   "options": "Patient", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -110,8 +49,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "reference_document", 
-   "fieldtype": "Dynamic Link", 
+   "fieldname": "appointment", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -119,193 +58,14 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Reference Document", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "reference_doctype", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disabled", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Disabled", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "submit_on_creation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Submit on Creation", 
+   "label": "Appointment", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Patient Appointment", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_5", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "start_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Start Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "end_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "End Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "next_schedule_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Next Schedule Date", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
@@ -320,8 +80,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency_detail", 
-   "fieldtype": "Section Break", 
+   "fieldname": "consultation", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -329,7 +89,37 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
+   "label": "Consultation", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Consultation", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -350,19 +140,19 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "frequency", 
-   "fieldtype": "Select", 
+   "default": "Today", 
+   "fieldname": "signs_date", 
+   "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
+   "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Frequency", 
+   "label": "Date", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDaily\nWeekly\nMonthly\nQuarterly\nHalf-yearly\nYearly", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -381,7 +171,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_12", 
+   "fieldname": "column_break_4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -406,13 +196,13 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 1, 
+   "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval: in_list([\"Monthly\", \"Quarterly\", \"Yearly\"], doc.frequency)", 
-   "fieldname": "repeat_on_day", 
-   "fieldtype": "Int", 
+   "default": "", 
+   "fieldname": "signs_time", 
+   "fieldtype": "Time", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -420,7 +210,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Repeat on Day", 
+   "label": "Time", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -430,7 +220,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -441,7 +231,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "notification", 
+   "fieldname": "sb_vs", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -450,7 +240,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Notification", 
+   "label": "Vital Signs", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -471,16 +261,17 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "notify_by_email", 
-   "fieldtype": "Check", 
+   "description": "Presence of a fever (temp &gt; 38.5 \u00b0C/101.3 \u00b0F or sustained temp &gt; 38 \u00b0C/100.4 \u00b0F)", 
+   "fieldname": "temperature", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "in_standard_filter": 0, 
-   "label": "Notify by Email", 
+   "label": "Body Temperature", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -501,7 +292,69 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "column_break_17", 
+   "description": "Adults' pulse rate is anywhere between 50 and 80 beats per minute.", 
+   "fieldname": "pulse", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Heart Rate / Pulse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Normal reference range for an adult is 16\u201320 breaths/minute (RCP 2012)", 
+   "fieldname": "respiratory_rate", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Respiratory rate", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_8", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -530,8 +383,99 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "recipients", 
+   "fieldname": "bp_systolic", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Blood Pressure (systolic)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "", 
+   "fieldname": "bp_diastolic", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Blood Pressure (diastolic)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "description": "Normal resting blood pressure in an adult is approximately 120 mmHg systolic, and 80 mmHg diastolic, abbreviated \"120/80 mmHg\"", 
+   "fieldname": "bp", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Blood Pressure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "vital_signs_note", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -540,7 +484,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Recipients", 
+   "label": "Notes", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -561,39 +505,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "notify_by_email", 
-   "fieldname": "print_format", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Print Format", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Print Format", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "columns": 0, 
-   "fieldname": "section_break_16", 
+   "fieldname": "sb_nutrition_values", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -602,7 +514,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "", 
+   "label": "Nutrition Values", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -623,9 +535,158 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "Draft", 
-   "fieldname": "status", 
-   "fieldtype": "Select", 
+   "fieldname": "height", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Height (In Meter)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "weight", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Weight (In Kilogram)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0.00", 
+   "fieldname": "bmi", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "BMI", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_14", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "nutrition_note", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Notes", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -633,15 +694,15 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Status", 
+   "label": "Company", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nSubmitted\nCancelled\nCompleted", 
+   "options": "Company", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -667,7 +728,7 @@
    "label": "Amended From", 
    "length": 0, 
    "no_copy": 1, 
-   "options": "Subscription", 
+   "options": "Vital Signs", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
@@ -690,10 +751,10 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-08-29 15:45:16.157643", 
+ "modified": "2017-09-04 14:31:57.851546", 
  "modified_by": "Administrator", 
- "module": "Subscription", 
- "name": "Subscription", 
+ "module": "Healthcare", 
+ "name": "Vital Signs", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [
@@ -711,7 +772,27 @@
    "print": 1, 
    "read": 1, 
    "report": 1, 
-   "role": "System Manager", 
+   "role": "Physician", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Nursing User", 
    "set_user_permissions": 0, 
    "share": 1, 
    "submit": 1, 
@@ -721,11 +802,12 @@
  "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "reference_document", 
- "show_name_in_global_search": 0, 
+ "restrict_to_domain": "Healthcare", 
+ "search_fields": "patient, signs_date", 
+ "show_name_in_global_search": 1, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "title_field": "reference_document", 
+ "title_field": "patient", 
  "track_changes": 1, 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
new file mode 100644
index 0000000..436f79f
--- /dev/null
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class VitalSigns(Document):
+	def on_submit(self):
+		insert_vital_signs_to_medical_record(self)
+
+	def on_cancel(self):
+		delete_vital_signs_from_medical_record(self)
+
+def insert_vital_signs_to_medical_record(doc):
+	subject = set_subject_field(doc)
+	medical_record = frappe.new_doc("Patient Medical Record")
+	medical_record.patient = doc.patient
+	medical_record.subject = subject
+	medical_record.status = "Open"
+	medical_record.communication_date = doc.signs_date
+	medical_record.reference_doctype = "Vital Signs"
+	medical_record.reference_name = doc.name
+	medical_record.reference_owner = doc.owner
+	medical_record.save(ignore_permissions=True)
+
+def delete_vital_signs_from_medical_record(doc):
+	medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(doc.name))
+	if(medical_record_id[0][0]):
+		frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
+
+def set_subject_field(doc):
+	subject = " "
+	if(doc.temperature):
+		subject += "Temperature: \n"+ str(doc.temperature)+". "
+	if(doc.pulse):
+		subject += "Pulse: \n"+ str(doc.pulse)+". "
+	if(doc.respiratory_rate):
+		subject += "Respiratory Rate: \n"+ str(doc.respiratory_rate)+". "
+	if(doc.bp):
+		subject += "BP: \n"+ str(doc.bp)+". "
+	if(doc.bmi):
+		subject += "BMI: \n"+ str(doc.bmi)+". "
+	if(doc.nutrition_note):
+		subject += "Note: \n"+ str(doc.nutrition_note)+". "
+
+	return subject
diff --git a/erpnext/healthcare/page/__init__.py b/erpnext/healthcare/page/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/erpnext/healthcare/page/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/page/appointment_analytic/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/page/appointment_analytic/__init__.py
diff --git a/erpnext/healthcare/page/appointment_analytic/appointment_analytic.js b/erpnext/healthcare/page/appointment_analytic/appointment_analytic.js
new file mode 100644
index 0000000..971d810
--- /dev/null
+++ b/erpnext/healthcare/page/appointment_analytic/appointment_analytic.js
@@ -0,0 +1,209 @@
+frappe.pages['appointment-analytic'].on_page_load = function(wrapper) {
+	frappe.ui.make_app_page({
+		parent: wrapper,
+		title: 'Appointment Analytics',
+		single_column: true
+	});
+	new erpnext.AppointmentAnalytics(wrapper);
+	frappe.breadcrumbs.add("Medical");
+};
+
+erpnext.AppointmentAnalytics = frappe.views.TreeGridReport.extend({
+	init: function(wrapper) {
+		this._super({
+			title: __("Appointment Analytics"),
+			parent: $(wrapper).find('.layout-main'),
+			page: wrapper.page,
+			doctypes: ["Patient Appointment", "Physician", "Medical Department", "Appointment Type", "Patient"],
+			tree_grid: { show: true }
+		});
+
+		this.tree_grids = {
+			"Medical Department": {
+				label: __("Department"),
+				show: true,
+				item_key: "physician",
+				parent_field: "department",
+				formatter: function(item) {
+					return item.name;
+				}
+			},
+			"Physician": {
+				label: __("Physician"),
+				show: true,
+				item_key: "physician",
+				formatter: function(item) {
+					return item.name;
+				}
+			},
+		};
+	},
+	setup_columns: function() {
+		this.tree_grid = this.tree_grids[this.tree_type];
+
+		var std_columns = [
+			{id: "_check", name: __("Plot"), field: "_check", width: 40,
+				formatter: this.check_formatter},
+			{id: "name", name: this.tree_grid.label, field: "name", width: 300,
+				formatter: this.tree_formatter},
+			{id: "total", name: "Total", field: "total", plot: false,
+				formatter: this.currency_formatter}
+		];
+
+		this.make_date_range_columns();
+		this.columns = std_columns.concat(this.columns);
+	},
+	filters: [
+		{fieldtype:"Select", label: __("Tree Type"), fieldname: "tree_type",
+			options:["Physician", "Medical Department"], filter: function(val, item, opts, me) {
+				return me.apply_zero_filter(val, item, opts, me);}},
+		{fieldtype:"Select", label: __("Status"), fieldname: "status",
+			options:[
+				{label: __("Select Status"), value: "Select Status..."},
+				{label: __("Open"), value: "Open"},
+				{label: __("Closed"), value: "Closed"},
+				{label: __("Pending"), value: "Pending"},
+				{label: __("Scheduled"), value: "Scheduled"},
+				{label: __("Cancelled"), value: "Cancelled"}]},
+		{fieldtype:"Select", label: __("Type"), link:"Appointment Type", fieldname: "type",
+			default_value: __("Select Type...")},
+		{fieldtype:"Select", label: __("Physician"), link:"Physician", fieldname: "physician",
+			default_value: __("Select Physician..."), filter: function(val, item, opts) {
+				return val == opts.default_value || item.name == val || item._show;
+			}, link_formatter: {filter_input: "physician"}},
+		{fieldtype:"Select", label: __("Department"), link:"Medical Department", fieldname: "department",
+			default_value: __("Select Department..."), filter: function(val, item, opts) {
+				return val == opts.default_value || item.department == val || item._show;
+			}, link_formatter: {filter_input: "department"}},
+		{fieldtype:"Date", label: __("From Date"), fieldname: "from_date"},
+		{fieldtype:"Date", label: __("To Date"), fieldname: "to_date"},
+		{fieldtype:"Select", label: __("Range"), fieldname: "range",
+			options:[{label: __("Daily"), value: "Daily"}, {label: __("Weekly"), value: "Weekly"},
+				{label: __("Monthly"), value: "Monthly"}, {label: __("Quarterly"), value: "Quarterly"},
+				{label: __("Yearly"), value: "Yearly"}]}
+	],
+	setup_filters: function() {
+		this._super();
+		this.trigger_refresh_on_change(["tree_type", "physician", "department", "status", "type"]);
+
+		//	this.show_zero_check()
+		this.setup_chart_check();
+	},
+	init_filter_values: function() {
+		this._super();
+		this.filter_inputs.range.val('Quarterly');
+	},
+	prepare_data: function() {
+		var me = this;
+		if (!this.tl) {
+			this.tl = frappe.report_dump.data["Patient Appointment"];
+		}
+		if(!this.data || me.item_type != me.tree_type) {
+			var items = null;
+			if(me.tree_type=='Physician') {
+				items = frappe.report_dump.data["Physician"];
+			} if(me.tree_type=='Medical Department') {
+				items = this.prepare_tree("Physician", "Medical Department");
+			}
+			me.item_type = me.tree_type;
+			me.parent_map = {};
+			me.item_by_name = {};
+			me.data = [];
+
+			$.each(items, function(i, v) {
+				var d = copy_dict(v);
+
+				me.data.push(d);
+				me.item_by_name[d.name] = d;
+				if(d[me.tree_grid.parent_field]) {
+					me.parent_map[d.name] = d[me.tree_grid.parent_field];
+				}
+				me.reset_item_values(d);
+			});
+
+			this.set_indent();
+
+
+		} else {
+			// otherwise, only reset values
+			$.each(this.data, function(i, d) {
+				me.reset_item_values(d);
+			});
+		}
+		this.prepare_balances();
+		if(me.tree_grid.show) {
+			this.set_totals(false);
+			this.update_groups();
+		} else {
+			this.set_totals(true);
+		}
+
+
+	},
+	prepare_balances: function() {
+		var me = this;
+		var from_date = frappe.datetime.str_to_obj(this.from_date);
+		var status = this.status;
+		var type = this.type;
+		var to_date = frappe.datetime.str_to_obj(this.to_date);
+		$.each(this.tl, function(i, tl) {
+			if (me.is_default('company') ? true : tl.company === me.company) {
+
+				var date = frappe.datetime.str_to_obj(tl.appointment_date);
+				if (date >= from_date && date <= to_date) {
+					var item = me.item_by_name[tl[me.tree_grid.item_key]] ||
+						me.item_by_name['Not Set'];
+
+					var d = tl.appointment_date.split(" ")[0];
+					if(status == "Select Status..." && type=="Select Type...")
+					{
+						item[me.column_map[d].field] += 1;
+
+					}else if (status !== "Select Status..." && type == "Select Type..."){
+						if(status === tl.status){item[me.column_map[d].field] += 1;}
+					}else if (status == "Select Status..." && type !== "Select Type..."){
+						if(type === tl.appointment_type){item[me.column_map[d].field] += 1;}
+					}else {
+						if(type === tl.appointment_type && status === tl.status){item[me.column_map[d].field] += 1;}
+					}
+				}
+			}
+		});
+	},
+	update_groups: function() {
+		var me = this;
+
+		$.each(this.data, function(i, item) {
+			var parent = me.parent_map[item.name];
+			while(parent) {
+				var parent_group = me.item_by_name[parent];
+
+				$.each(me.columns, function(c, col) {
+					if (col.formatter == me.currency_formatter) {
+						parent_group[col.field] =
+							flt(parent_group[col.field])
+							+ flt(item[col.field]);
+					}
+				});
+				parent = me.parent_map[parent];
+			}
+		});
+	},
+	set_totals: function(sort) {
+		var me = this;
+		$.each(this.data, function(i, d) {
+			d.total = 0.0;
+			$.each(me.columns, function(i, col) {
+				if(col.formatter==me.currency_formatter && !col.hidden && col.field!="total")
+					d.total += d[col.field];
+			});
+		});
+
+		if(sort)this.data = this.data.sort(function(a, b) { return b.total - a.total; });
+
+		if(!this.checked) {
+			this.data[0].checked = true;
+		}
+	}
+
+});
diff --git a/erpnext/healthcare/page/appointment_analytic/appointment_analytic.json b/erpnext/healthcare/page/appointment_analytic/appointment_analytic.json
new file mode 100644
index 0000000..4deff80
--- /dev/null
+++ b/erpnext/healthcare/page/appointment_analytic/appointment_analytic.json
@@ -0,0 +1,22 @@
+{
+ "content": null,
+ "creation": "2016-08-18 12:29:52.497819",
+ "docstatus": 0,
+ "doctype": "Page",
+ "idx": 0,
+ "modified": "2016-08-18 12:29:52.497819",
+ "modified_by": "Administrator",
+ "module": "Healthcare",
+ "name": "appointment-analytic",
+ "owner": "Administrator",
+ "page_name": "Appointment Analytics",
+ "roles": [
+  {
+   "role": "Physician"
+  }
+ ],
+ "script": null,
+ "standard": "Yes",
+ "style": null,
+ "title": "Appointment Analytics"
+}
diff --git a/erpnext/healthcare/page/medical_record/__init__.py b/erpnext/healthcare/page/medical_record/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/healthcare/page/medical_record/medical_record.css b/erpnext/healthcare/page/medical_record/medical_record.css
new file mode 100644
index 0000000..e76df0f
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/medical_record.css
@@ -0,0 +1,73 @@
+#page-medical_record .label {
+	display: inline-block;
+	margin-right: 7px;
+}
+
+#page-medical_record .list-row {
+	border: none;
+	padding: 0px;
+	cursor: pointer;
+}
+
+.medical_record-label {
+	max-width: 100px;
+	margin-bottom: -4px;
+}
+
+.date-indicator {
+    background:none;
+    font-size:12px;
+    vertical-align:middle;
+    font-weight:bold;
+    color:#6c7680;
+}
+.date-indicator::after {
+    margin:0 -4px 0 12px;
+    content:'';
+    display:inline-block;
+    height:8px;
+    width:8px;
+    border-radius:8px;
+	background: #d1d8dd;
+}
+
+.date-indicator.blue {
+	color: #5e64ff;
+}
+
+.date-indicator.blue::after {
+	background: #5e64ff;
+}
+
+.medical_record-message {
+	border-left: 1px solid #d1d8dd;
+	padding: 15px;
+	padding-right: 30px;
+}
+
+.medical_record-date {
+	padding: 15px;
+	padding-right: 0px;
+	z-index: 1;
+}
+
+#page-medical_record .plot-wrapper {
+	padding: 20px 15px;
+	border-bottom: 1px solid #d1d8dd;
+	text-align: center;
+}
+
+#page-medical_record .plot {
+	height: 140px ;
+	width: 97% ;
+	margin: auto;
+}
+
+#page-medical_record .list-filters {
+	display: none ;
+}
+
+#page-medical_record .octicon-heart {
+	color: #ff5858;
+	margin: 0px 5px;
+}
diff --git a/erpnext/healthcare/page/medical_record/medical_record.js b/erpnext/healthcare/page/medical_record/medical_record.js
new file mode 100644
index 0000000..df19d8f
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/medical_record.js
@@ -0,0 +1,182 @@
+frappe.provide("frappe.medical_record");
+frappe.pages['medical_record'].on_page_load = function(wrapper) {
+	var me = this;
+	var page = frappe.ui.make_app_page({
+		parent: wrapper,
+		title: 'Medical Record',
+	});
+
+	frappe.breadcrumbs.add("Medical");
+
+	page.main.html(frappe.render_template("patient_select", {}));
+	var patient = frappe.ui.form.make_control({
+		parent: page.main.find(".patient"),
+		df: {
+			fieldtype: "Link",
+			options: "Patient",
+			fieldname: "patient",
+			change: function(){
+				page.main.find(".frappe-list").html("");
+				draw_page(patient.get_value(), me);
+			}
+		},
+		only_input: true,
+	});
+	patient.refresh();
+
+
+	this.page.main.on("click", ".medical_record-message", function() {
+		var	doctype = $(this).attr("data-doctype"),
+			docname = $(this).attr("data-docname");
+
+		if (doctype && docname) {
+			frappe.route_options = {
+				scroll_to: { "doctype": doctype, "name": docname }
+			};
+			frappe.set_route(["Form", doctype, docname]);
+		}
+	});
+
+	this.page.sidebar.on("click", ".edit-details", function() {
+		patient = patient.get_value();
+		if (patient) {
+			frappe.set_route(["Form", "Patient", patient]);
+		}
+	});
+
+};
+
+frappe.pages['medical_record'].refresh = function() {
+	var me = this;
+
+	if(frappe.route_options) {
+		if(frappe.route_options.patient){
+			me.page.main.find(".frappe-list").html("");
+			var patient = frappe.route_options.patient;
+			draw_page(patient,me);
+			me.page.main.find("[data-fieldname='patient']").val(patient);
+			frappe.route_options = null;
+		}
+	}
+};
+var show_patient_info = function(patient, me){
+	frappe.call({
+		"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
+		args: {
+			patient: patient
+		},
+		callback: function (r) {
+			var data = r.message;
+			var details = "";
+			if(data.email) details += "<br><b>Email :</b> " + data.email;
+			if(data.mobile) details += "<br><b>Mobile :</b> " + data.mobile;
+			if(data.occupation) details += "<br><b>Occupation :</b> " + data.occupation;
+			if(data.blood_group) details += "<br><b>Blood group : </b> " + data.blood_group;
+			if(data.allergies) details +=  "<br><br><b>Allergies : </b> "+  data.allergies;
+			if(data.medication) details +=  "<br><b>Medication : </b> "+  data.medication;
+			if(data.alcohol_current_use) details +=  "<br><br><b>Alcohol use : </b> "+  data.alcohol_current_use;
+			if(data.alcohol_past_use) details +=  "<br><b>Alcohol past use : </b> "+  data.alcohol_past_use;
+			if(data.tobacco_current_use) details +=  "<br><b>Tobacco use : </b> "+  data.tobacco_current_use;
+			if(data.tobacco_past_use) details +=  "<br><b>Tobacco past use : </b> "+  data.tobacco_past_use;
+			if(data.medical_history) details +=  "<br><br><b>Medical history : </b> "+  data.medical_history;
+			if(data.surgical_history) details +=  "<br><b>Surgical history : </b> "+  data.surgical_history;
+			if(data.surrounding_factors) details +=  "<br><br><b>Occupational hazards : </b> "+  data.surrounding_factors;
+			if(data.other_risk_factors) details += "<br><b>Other risk factors : </b> " + data.other_risk_factors;
+			if(data.patient_details) details += "<br><br><b>More info : </b> " + data.patient_details;
+
+			if(details){
+				details = "<div style='padding-left:10px; font-size:13px;' align='center'></br><b class='text-muted'>Patient Details</b>" + details + "</div>";
+			}
+
+			var vitals = "";
+			if(data.temperature) vitals += "<br><b>Temperature :</b> " + data.temperature;
+			if(data.pulse) vitals += "<br><b>Pulse :</b> " + data.pulse;
+			if(data.respiratory_rate) vitals += "<br><b>Respiratory Rate :</b> " + data.respiratory_rate;
+			if(data.bp) vitals += "<br><b>BP :</b> " + data.bp;
+			if(data.bmi) vitals += "<br><b>BMI :</b> " + data.bmi;
+			if(data.height) vitals += "<br><b>Height :</b> " + data.height;
+			if(data.weight) vitals += "<br><b>Weight :</b> " + data.weight;
+			if(data.signs_date) vitals += "<br><b>Date :</b> " + data.signs_date;
+
+			if(vitals){
+				vitals = "<div style='padding-left:10px; font-size:13px;' align='center'></br><b class='text-muted'>Vital Signs</b>" + vitals + "<br></div>";
+				details = vitals + details;
+			}
+			if(details) details += "<div align='center'><br><a class='btn btn-default btn-sm edit-details'>Edit Details</a></b> </div>";
+
+			me.page.sidebar.addClass("col-sm-3");
+			me.page.sidebar.html(details);
+			me.page.wrapper.find(".layout-main-section-wrapper").addClass("col-sm-9");
+		}
+	});
+};
+var draw_page = function(patient, me){
+	frappe.model.with_doctype("Patient Medical Record", function() {
+		me.page.list = new frappe.ui.BaseList({
+			hide_refresh: true,
+			page: me.page,
+			method: 'erpnext.healthcare.page.medical_record.medical_record.get_feed',
+			args: {name: patient},
+			parent: $("<div></div>").appendTo(me.page.main),
+			render_view: function(values) {
+				var me = this;
+				var wrapper = me.page.main.find(".result-list").get(0);
+				values.map(function (value) {
+					var row = $('<div class="list-row">').data("data", value).appendTo($(wrapper)).get(0);
+					new frappe.medical_record.Feed(row, value);
+				});
+			},
+			show_filters: true,
+			doctype: "Patient Medical Record",
+		});
+		show_patient_info(patient, me);
+		me.page.list.run();
+	});
+};
+
+frappe.medical_record.last_feed_date = false;
+frappe.medical_record.Feed = Class.extend({
+	init: function(row, data) {
+		this.scrub_data(data);
+		this.add_date_separator(row, data);
+		if(!data.add_class)
+			data.add_class = "label-default";
+
+		data.link = "";
+		if (data.reference_doctype && data.reference_name) {
+			data.link = frappe.format(data.reference_name, {fieldtype: "Link", options: data.reference_doctype},
+				{label: __(data.reference_doctype)});
+		}
+
+		$(row)
+			.append(frappe.render_template("medical_record_row", data))
+			.find("a").addClass("grey");
+	},
+	scrub_data: function(data) {
+		data.by = frappe.user.full_name(data.owner);
+		data.imgsrc = frappe.utils.get_file_link(frappe.user_info(data.owner).image);
+
+		data.icon = "icon-flag";
+	},
+	add_date_separator: function(row, data) {
+		var date = frappe.datetime.str_to_obj(data.creation);
+		var last = frappe.medical_record.last_feed_date;
+
+		if((last && frappe.datetime.obj_to_str(last) != frappe.datetime.obj_to_str(date)) || (!last)) {
+			var diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(), frappe.datetime.obj_to_str(date));
+			if(diff < 1) {
+				var pdate = 'Today';
+			} else if(diff < 2) {
+				pdate = 'Yesterday';
+			} else {
+				pdate = frappe.datetime.global_date_format(date);
+			}
+			data.date_sep = pdate;
+			data.date_class = pdate=='Today' ? "date-indicator blue" : "date-indicator";
+		} else {
+			data.date_sep = null;
+			data.date_class = "";
+		}
+		frappe.medical_record.last_feed_date = date;
+	}
+});
diff --git a/erpnext/healthcare/page/medical_record/medical_record.json b/erpnext/healthcare/page/medical_record/medical_record.json
new file mode 100644
index 0000000..7c786ca
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/medical_record.json
@@ -0,0 +1,23 @@
+{
+ "content": null,
+ "creation": "2016-06-09 11:33:14.025787",
+ "docstatus": 0,
+ "doctype": "Page",
+ "icon": "icon-play",
+ "idx": 0,
+ "modified": "2017-03-06 11:20:40.174661",
+ "modified_by": "Administrator",
+ "module": "Healthcare",
+ "name": "medical_record",
+ "owner": "Administrator",
+ "page_name": "medical_record",
+ "roles": [
+  {
+   "role": "Physician"
+  }
+ ],
+ "script": null,
+ "standard": "Yes",
+ "style": null,
+ "title": "Medical Record"
+}
diff --git a/erpnext/healthcare/page/medical_record/medical_record.py b/erpnext/healthcare/page/medical_record/medical_record.py
new file mode 100644
index 0000000..22c5852
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/medical_record.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, ESS LLP and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import cint
+
+@frappe.whitelist()
+def get_feed(start, page_length, name):
+	"""get feed"""
+	result = frappe.db.sql("""select name, owner, modified, creation,
+			reference_doctype, reference_name, subject
+		from `tabPatient Medical Record`
+		where patient=%(patient)s
+		order by creation desc
+		limit %(start)s, %(page_length)s""",
+		{
+			"start": cint(start),
+			"page_length": cint(page_length),
+			"patient": name
+		}, as_dict=True)
+
+	return result
diff --git a/erpnext/healthcare/page/medical_record/medical_record_row.html b/erpnext/healthcare/page/medical_record/medical_record_row.html
new file mode 100644
index 0000000..6b79146
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/medical_record_row.html
@@ -0,0 +1,21 @@
+<div class="row medical_record-row" data-creation="{%= creation.split(" ")[0] + " 00:00:00" %}">
+	<div class="col-xs-3 text-right medical_record-date"><span class="{%= date_class %}">
+		{%= date_sep || "" %}</span>
+	</div>
+	<div class="col-xs-9 medical_record-message"
+		data-doctype="{%= reference_doctype %}"
+		data-docname="{%= reference_name %}"
+		title="{%= by %} / {%= dateutil.str_to_user(creation) %}">
+		<span class="avatar avatar-small">
+			<div class="avatar-frame" style="background-image: url({{ imgsrc }});"></div>
+			<!-- <img src="{%= imgsrc %}"> -->
+		</span>
+		<span class="small">
+		{% if (reference_doctype && reference_name) { %}
+			{%= __("{0}: {1}", [link, "<strong>" + subject + "</strong>"]) %}
+		{% } else { %}
+			{%= subject %}
+		{% } %}
+	</span>
+	</div>
+</div>
diff --git a/erpnext/healthcare/page/medical_record/patient_select.html b/erpnext/healthcare/page/medical_record/patient_select.html
new file mode 100644
index 0000000..321baf7
--- /dev/null
+++ b/erpnext/healthcare/page/medical_record/patient_select.html
@@ -0,0 +1,5 @@
+<div class="text-center col-sm-9" style="padding: 40px;">
+
+    	<p>{%= __("Select Patient") %}</p>
+	<p class="patient" style="margin: auto; max-width: 300px; margin-bottom: 20px;"></p>
+</div>
diff --git a/erpnext/subscription/__init__.py b/erpnext/healthcare/print_format/__init__.py
similarity index 100%
copy from erpnext/subscription/__init__.py
copy to erpnext/healthcare/print_format/__init__.py
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/print_format/consultation_print/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/print_format/consultation_print/__init__.py
diff --git a/erpnext/healthcare/print_format/consultation_print/consultation_print.json b/erpnext/healthcare/print_format/consultation_print/consultation_print.json
new file mode 100644
index 0000000..05b8b43
--- /dev/null
+++ b/erpnext/healthcare/print_format/consultation_print/consultation_print.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_left": 0, 
+ "creation": "2017-04-10 14:05:53.355863", 
+ "custom_format": 1, 
+ "disabled": 0, 
+ "doc_type": "Consultation", 
+ "docstatus": 0, 
+ "doctype": "Print Format", 
+ "font": "Default", 
+ "html": "<div >\n    {% if letter_head and not no_letterhead -%}\n    <div class=\"letter-head\">{{ letter_head }}</div>\n    <hr>\n    {% else %}\n    <div align=\"right\">\n      <h1>{{doc.name}}</h1>\n    </div>\n    {%- endif %}\n    <div class=\"row section-break\">\n        <div class=\"col-xs-6 column-break\">\n                {% if doc.appointment %}\n\t        <div class=\"row\">\n\t\t\t<div class=\"col-xs-4 text-left\">\n\t\t\t<label>Appointment</label>\n\t\t\t</div>\n\t\t\t<div class=\"col-xs-7  value\">\n\t\t\t<strong>: </strong>{{doc.appointment}}\n\t\t\t</div>\n\t\t</div>\n\t\t{%- endif -%}\n\n                <div class=\"row\">\n\t\t      <div class=\"col-xs-4 text-left\">\n\t\t\t <label>Patient</label>\n\t\t      </div>\n                     {% if doc.patient %}\n\t\t      <div class=\"col-xs-7  value\">\n\t\t\t  <strong>: </strong>{{doc.patient}}\n\t\t      </div>\n                     {% else %}\n                     <div class=\"col-xs-7  value\">\n\t\t\t <strong>: </strong><em>Patient Name</em>\n\t\t     </div>\n                     {%- endif -%}\n\t\t</div>\n\t        <div class=\"row\">\n\t\t\t<div class=\"col-xs-4 text-left\">\n\t\t\t\t<label>Age</label>\n\t\t\t</div>\n\t\t\t<div class=\"col-xs-7  value\">\n\t\t\t     <strong>: </strong> {{doc.patient_age}}\n\t\t\t</div>\n\t\t</div>\n\n                <div class=\"row\">\n                        <div class=\"col-xs-4 text-left\">\n\t\t\t\t<label>Gender</label>\n\t\t\t</div>\n\t\t\t<div class=\"col-xs-7  value\">\n\t\t\t     <strong>: </strong> {{doc.patient_sex}}\n\t\t\t</div>\n                </div>\n\n        </div>\n        <div class=\"col-xs-6 column-break\">\n\n          <div class=\"row\">\n\t      <div class=\"col-xs-4 text-left\">\n\t\t    <label>Doctor</label>\n\t      </div>\n              {% if doc.physician %}\n\t      <div class=\"col-xs-7  text-left value\">\n\t\t\t<strong>: </strong>{{doc.physician}}\n\t      </div>\n              {%- endif -%}\n\t</div>\n\n          {% if doc.consultation_date %}\n\t  <div class=\"row\">\n\t\t<div class=\"col-xs-4 text-left\">\n\t\t<label>Date</label>\n\t\t</div>\n\t\t<div class=\"col-xs-7 text-left value\">\n\t\t<strong>: </strong>{{doc.consultation_date}}\n\t\t</div>\n          </div>\n\t  {%- endif -%}\n          {% if doc.consultation_time %}\n\t  <div class=\"row\">\n\t\t<div class=\"col-xs-4 text-left\">\n\t\t<label>Time</label>\n\t\t</div>\n\t\t<div class=\"col-xs-7 text-left value\">\n\t\t<strong>: </strong>{{doc.consultation_time}}\n\t\t</div>\n          </div>\n\t  {%- endif -%}\n          {% if doc.visit_department %}\n\t  <div class=\"row\">\n\t\t<div class=\"col-xs-4 text-left\">\n\t\t<label>Department</label>\n\t\t</div>\n\t\t<div class=\"col-xs-7 text-left value\">\n\t\t<strong>: </strong>{{doc.visit_department}}\n\t\t</div>\n          </div>\n          {%- endif -%}\n        </div>\n\n   </div>\n\n</div>\n<div>\n     <hr>\n     {% if doc.symptoms_in_print%}\n       {% if doc.symptoms %}\n         Complaints:\n         <strong>{{doc.symptoms}}</strong>\n  \t   <br>\n       {%- endif -%}\n     {%- endif -%}\n\n     {% if doc.diagnosis_in_print%}\n       {% if doc.diagnosis %}\n  \t     Diagnosis:\n         <strong>{{doc.diagnosis}}</strong>\n         <br>\n       {%- endif -%}\n     {%- endif -%}\n\n</div>\n\n<div>\n      {% if doc.drug_prescription %}\n      <br>\n      Rx,\n      <table class=\"table\">\n        <tbody>\n            <!--<tr>\n                <th>Drug</th>\n                <th class=\"text-left\">Dosage</th>\n                <th class=\"text-left\">Period</th>\n                <th>Remark</th>\n            </tr>-->\n\n            {%- for row in doc.drug_prescription -%}\n            <tr>\n              <td style=\"width: 30%;border:none;\">\n                {%- if row.drug_name -%}<b>{{ row.drug_name }}</b>{%- endif -%}\n              </td>\n            \t<td style=\"width: 20%;text-align: left;border:none;\">\n                {%- if row.dosage -%}{{ row.dosage }}{%- endif -%}\n              </td>\n            \t<td style=\"width: 20%;text-align: left;border:none;\">\n                {%- if row.period -%}{{ row.period }}{%- endif -%}\n\t\t          </td>\n              <td style=\"width: 30%;text-align: left;border:none;\">\n\t\t\t             <div style=\"border: 0px;\">\n                      {%- if row.comment -%}{{ row.comment }}{%- endif -%}\n                   </div>\n\t\t           </td>\n            </tr>\n\t          {%- endfor -%}\n       </tbody>\n      </table>\n\n\n      {%- endif -%}\n</div>\n\n\n<div>\n      {% if doc.test_prescription %}\n      Investigations,\n      <table class=\"table\">\n        <tbody>\n            <!--<tr>\n                <th>Test</th>\n                <th>Remark</th>\n            </tr>-->\n\n            {%- for row in doc.test_prescription -%}\n            <tr>\n              <td style=\"width: 30%;border:none;\">\n                {%- if row.test_name -%}<b>{{ row.test_name }}</b>{%- endif -%}\n              </td>\n              <td style=\"width: 30%;text-align: left;border:none;\">\n\t\t\t           <div style=\"border: 0px;\">\n                   {%- if row.test_comment -%}{{ row.test_comment }}{%- endif -%}\n                 </div>\n\t\t          </td>\n             </tr>\n\n\t           {%- endfor -%}\n       </tbody>\n      </table>\n\n\n      {%- endif -%}\n</div>\n<div>\n    {% if doc.consultation_comment %}\n      <br>\n      {{doc.consultation_comment}}\n     {%- endif -%}\n</div>\n", 
+ "idx": 0, 
+ "line_breaks": 0, 
+ "modified": "2017-05-15 16:36:06.034909", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Consultation Print", 
+ "owner": "Administrator", 
+ "print_format_builder": 0, 
+ "print_format_type": "Server", 
+ "show_section_headings": 0, 
+ "standard": "Yes"
+}
\ No newline at end of file
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/print_format/lab_test_print/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/print_format/lab_test_print/__init__.py
diff --git a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json
new file mode 100644
index 0000000..e3e21a7
--- /dev/null
+++ b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_left": 0,
+ "creation": "2017-04-24 15:38:45.332473",
+ "custom_format": 1,
+ "disabled": 0,
+ "doc_type": "Lab Test",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "html": "<div >\n  {% if letter_head and not no_letterhead -%}\n    <div class=\"letter-head\">{{ letter_head }}</div>\n    <hr>\n  {%- endif %}\n\n  {% if (doc.docstatus != 1) %}\n  <b>Lab Tests have to be Submitted for Print .. !</b>\n  {% elif (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"require_test_result_approval\") == '1' and doc.approval_status != \"Approved\") %}\n  <b>Lab Tests have to be Approved for Print .. !</b>\n  {%- else -%}\n  <div class=\"row section-break\">\n    <div class=\"col-xs-6 column-break\">\n      {% if doc.invoice %}\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Order No.</label>\n        </div>\n        <div class=\"col-xs-7  value\">\n          <strong>: </strong>{{doc.invoice}}\n        </div>\n      </div>\n      {%- endif -%}\n\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Patient</label>\n        </div>\n        {% if doc.patient %}\n        <div class=\"col-xs-7  value\">\n          <strong>: </strong>{{doc.patient}}\n        </div>\n        {% else %}\n        <div class=\"col-xs-7  value\">\n          <strong>: </strong><em>Patient Name</em>\n        </div>\n        {%- endif -%}\n      </div>\n\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Age</label>\n        </div>\n        <div class=\"col-xs-7  value\">\n          <strong>: </strong> {{doc.patient_age}}\n        </div>\n      </div>\n\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Gender</label>\n        </div>\n        <div class=\"col-xs-7  value\">\n          <strong>: </strong> {{doc.patient_sex}}\n        </div>\n      </div>\n\n    </div>\n\n    <div class=\"col-xs-6 column-break\">\n\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Doctor</label>\n        </div>\n        {% if doc.physician %}\n        <div class=\"col-xs-7  text-left value\">\n          <strong>: </strong>{{doc.physician}}\n        </div>\n        {%- endif -%}\n      </div>\n\n      {% if doc.sample_date %}\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Sample Date</label>\n        </div>\n        <div class=\"col-xs-7 text-left value\">\n          <strong>: </strong>{{doc.sample_date}}\n        </div>\n      </div>\n      {%- endif -%}\n\n      {% if doc.result_date %}\n      <div class=\"row\">\n        <div class=\"col-xs-4 text-left\">\n          <label>Result Date</label>\n        </div>\n        <div class=\"col-xs-7 text-left value\">\n          <strong>: </strong>{{doc.result_date}}\n        </div>\n      </div>\n      {%- endif -%}\n\n    </div>\n\n  </div>\n\n  <div align=\"center\">\n    <hr><h4 class=\"text-uppercase\"><b><u>Department of {{doc.department}}</u></b></h4>\n  </div>\n\n  <table class=\"table\">\n    <tbody>\n      {%- if doc.normal_test_items -%}\n      <tr>\n        <th>Name of Test</th>\n        <th class=\"text-left\">Result</th>\n        <th class=\"text-right\">Normal Range</th>\n      </tr>\n\n      {%- if doc.normal_test_items|length > 1 %}\n      <tr><td style=\"width: 40%;\"> <b>{{ doc.test_name }}</b> </td><td></td></tr>\n      {%- endif -%}\n\n      {%- for row in doc.normal_test_items -%}\n      <tr>\n        <td style=\"width: 40%;border:none;\">\n          {%- if doc.normal_test_items|length > 1 %}&emsp;&emsp;{%- endif -%}\n          {%- if row.test_name -%}<b>{{ row.test_name }}</b>\n          {%- else -%}&emsp;&emsp;&emsp;{%- endif -%}\n          {%- if row.test_event -%} &emsp;&emsp;{{ row.test_event }}{%- endif -%}\n        </td>\n\n        <td style=\"width: 20%;text-align: left;border:none;\">\n          {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}&emsp;\n          {%- if row.test_uom -%}{{ row.test_uom }}{%- endif -%}\n        </td>\n\n        <td style=\"width: 30%;text-align: right;border:none;\">\n          <div style=\"border: 0px;\">\n            {%- if row.normal_range -%}{{ row.normal_range }}{%- endif -%}\n          </div>\n        </td>\n      </tr>\n\n      {%- endfor -%}\n      {%- endif -%}\n    </tbody>\n  </table>\n\n  <table class=\"table\">\n    <tbody>\n      {%- if doc.special_test_items -%}\n      <tr>\n        <th>Name of Test</th>\n        <th class=\"text-left\">Result</th>\n      </tr>\n      <tr><td style=\"width: 30%;border:none;\"> <b>{{ doc.test_name }}</b> </td><td></td></tr>\n      {%- for row in doc.special_test_items -%}\n      <tr>\n        <td style=\"width: 30%;border:none;\"> &emsp;&emsp;{{ row.test_particulars }} </td>\n        <td style=\"width: 70%;text-align: left;border:none;\">\n          {%- if row.result_value -%}{{ row.result_value }}{%- endif -%}\n        </td>\n      </tr>\n\n      {%- endfor -%}\n      {%- endif -%}\n\n      {%- if doc.sensitivity_test_items -%}\n      <tr>\n        <th>Antibiotic</th>\n        <th class=\"text-left\">Sensitivity</th>\n      </tr>\n      {%- for row in doc.sensitivity_test_items -%}\n      <tr>\n        <td style=\"width: 30%;border:none;\"> {{ row.antibiotic }} </td>\n        <td style=\"width: 70%;text-align: left;border:none;\">{{ row.antibiotic_sensitivity }}</td>\n      </tr>\n\n      {%- endfor -%}\n      {%- endif -%}\n\n    </tbody>\n  </table>\n  {%- endif -%}\n\n  <div align=\"right\">\n    {%- if (frappe.db.get_value(\"Healthcare Settings\", \"None\", \"employee_name_and_designation_in_print\") == '1') -%}\n    <h6 class=\"text-uppercase\"><b>{{doc.employee_name}}</b></h6>\n    <h6 class=\"text-uppercase\"><b>{{doc.employee_designation}}</b></h6>\n    {%- else -%}\n    <h6 ><b>{{frappe.db.get_value(\"Healthcare Settings\", \"None\", \"custom_signature_in_print\") }}</b></h6>\n    {%- endif -%}\n  </div>\n</div>\n", 
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2017-04-27 12:11:58.342145",
+ "modified_by": "Administrator",
+ "module": "Healthcare",
+ "name": "Lab Test Print",
+ "owner": "Administrator",
+ "print_format_builder": 0,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
+ "standard": "Yes"
+}
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/print_format/sample_id_print/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/print_format/sample_id_print/__init__.py
diff --git a/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
new file mode 100644
index 0000000..e99ce70
--- /dev/null
+++ b/erpnext/healthcare/print_format/sample_id_print/sample_id_print.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_left": 0,
+ "creation": "2017-02-17 17:40:52.967840",
+ "custom_format": 1,
+ "disabled": 0,
+ "doc_type": "Sample Collection",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 170%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 6in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 2in;\n\t\t}\n\t}\n</style>\n{% set column = 0 %}\n<table>\n{% for _ in range(0, doc.num_print) %}\n{% if column == 0 -%}<tr>{% endif %}\n\t<td style=\"width: 2in; height: 1.8in;\">{{doc.name}}<br>{{doc.patient}}<br>\n{% if doc.patient_age %}{{doc.patient_age}}, {% endif %} {% if doc.patient_sex %}{{doc.patient_sex}}{% endif %}<br> {% if doc.collected_time %}{{doc.collected_time}} {% endif %}<br>{% if doc.collected_by %} {{doc.collected_by}} {% endif %}</td>\n{% if column == 0 %}{% set column = column+1 %}\n{% elif column == 2%} </tr>{%- set column = 0 %}\n{% else %}{%- set column = column+1 -%}{%- endif %}\n\t\n{% endfor %}\n</table>",
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2017-03-30 18:09:39.537609",
+ "modified_by": "Administrator",
+ "module": "Healthcare",
+ "name": "Sample ID Print", 
+ "owner": "Administrator",
+ "print_format_builder": 0,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
+ "standard": "Yes"
+}
diff --git a/erpnext/subscription/__init__.py b/erpnext/healthcare/report/__init__.py
similarity index 100%
copy from erpnext/subscription/__init__.py
copy to erpnext/healthcare/report/__init__.py
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/report/lab_test_report/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/report/lab_test_report/__init__.py
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.js b/erpnext/healthcare/report/lab_test_report/lab_test_report.js
new file mode 100644
index 0000000..3128f81
--- /dev/null
+++ b/erpnext/healthcare/report/lab_test_report/lab_test_report.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2016, ESS
+// License: See license.txt
+
+frappe.query_reports["Lab Test Report"] = {
+	"filters": [
+		{
+			"fieldname":"from_date",
+			"label": __("From Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.now_date(),
+			"width": "80"
+		},
+		{
+			"fieldname":"to_date",
+			"label": __("To Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.now_date()
+		},
+		{
+			"fieldname":"patient",
+			"label": __("Patient"),
+			"fieldtype": "Link",
+			"options": "Patient"
+		},
+		{
+			"fieldname":"department",
+			"label": __("Medical Department"),
+			"fieldtype": "Link",
+			"options": "Medical Department"
+		}
+	]
+};
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.json b/erpnext/healthcare/report/lab_test_report/lab_test_report.json
new file mode 100644
index 0000000..f133a8e
--- /dev/null
+++ b/erpnext/healthcare/report/lab_test_report/lab_test_report.json
@@ -0,0 +1,26 @@
+{
+ "add_total_row": 1, 
+ "apply_user_permissions": 1, 
+ "creation": "2013-04-23 18:15:29", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 1, 
+ "is_standard": "Yes", 
+ "modified": "2017-08-23 14:54:12.593140", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "Lab Test Report", 
+ "owner": "Administrator", 
+ "ref_doctype": "Lab Test", 
+ "report_name": "Lab Test Report", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Laboratory User"
+  }, 
+  {
+   "role": "System Manager"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.py b/erpnext/healthcare/report/lab_test_report/lab_test_report.py
new file mode 100644
index 0000000..61769f8
--- /dev/null
+++ b/erpnext/healthcare/report/lab_test_report/lab_test_report.py
@@ -0,0 +1,58 @@
+# Copyright (c) 2016, ESS
+# License: See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import msgprint, _
+
+def execute(filters=None):
+	if not filters: filters = {}
+
+	lab_test_list = get_lab_test(filters)
+	columns = get_columns()
+
+	if not lab_test_list:
+		msgprint(_("No record found"))
+		return columns, lab_test_list
+
+	data = []
+	for lab_test in lab_test_list:
+		row = [ lab_test.test_name, lab_test.patient, lab_test.physician, lab_test.invoice, lab_test.status, lab_test.result_date, lab_test.department]
+		data.append(row)
+
+	return columns, data
+
+
+def get_columns():
+	columns = [
+		_("Test") + ":Data:120",
+		_("Patient") + ":Link/Patient:180",
+		_("Doctor") + ":Link/Physician:120",
+		_("Invoice") + ":Link/Sales Invoice:120",
+		_("Status") + ":Data:120",
+		_("Result Date") + ":Date:120",
+		_("Department") + ":Data:120",
+	]
+
+	return columns
+
+def get_conditions(filters):
+	conditions = ""
+
+	if filters.get("patient"):
+		conditions += "and patient = %(patient)s"
+	if filters.get("from_date"):
+		conditions += "and result_date >= %(from_date)s"
+	if filters.get("to_date"):
+		conditions += " and result_date <= %(to_date)s"
+	if filters.get("department"):
+		conditions += " and department = %(department)s"
+
+	return conditions
+
+def get_lab_test(filters):
+	conditions = get_conditions(filters)
+	return frappe.db.sql("""select name, patient, test_name, patient_name, status, result_date, physician, invoice, department
+		from `tabLab Test`
+		where docstatus<2 %s order by submitted_date desc, name desc""" %
+		conditions, filters, as_dict=1)
diff --git a/erpnext/subscription/__init__.py b/erpnext/healthcare/web_form/__init__.py
similarity index 100%
copy from erpnext/subscription/__init__.py
copy to erpnext/healthcare/web_form/__init__.py
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/web_form/lab_test/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/web_form/lab_test/__init__.py
diff --git a/erpnext/healthcare/web_form/lab_test/lab_test.js b/erpnext/healthcare/web_form/lab_test/lab_test.js
new file mode 100644
index 0000000..efcd8ab
--- /dev/null
+++ b/erpnext/healthcare/web_form/lab_test/lab_test.js
@@ -0,0 +1,34 @@
+frappe.ready(function() {
+	//	bind events here
+	var normal_test_items = $('div[data-fieldname = "normal_test_items"]');
+	var normal_test_items_add_btn = $('button[data-fieldname = "normal_test_items"]');
+	var special_test_items = $('div[data-fieldname = "special_test_items"]');
+	var special_test_items_add_btn = $('button[data-fieldname = "special_test_items"]');
+	var sensitivity_test_items = $('div[data-fieldname = "sensitivity_test_items"]');
+	var sensitivity_test_items_add_btn = $('button[data-fieldname = "sensitivity_test_items"]');
+	var sensitivity_toggle = $('input[name = "sensitivity_toggle"]');
+	var special_toggle = $('input[name = "special_toggle"]');
+	var normal_toggle = $('input[name = "normal_toggle"]');
+	if(normal_toggle.val() == 1){
+		//	normal_test_items[0].style.display = "none";
+		//	normal_test_items[0].setAttribute("hidden", true);
+		//	normal_test_items_add_btn[0].style.visibility = "hidden";
+		special_test_items[0].style.display = "none";
+		special_test_items_add_btn[0].style.display = "none";
+		sensitivity_test_items[0].style.display = "none";
+		sensitivity_test_items_add_btn[0].style.display = "none";
+		normal_test_items_add_btn[0].style.display = "none";
+	}else if(sensitivity_toggle.val() == 1){
+		special_test_items[0].style.display = "none";
+		special_test_items_add_btn[0].style.display = "none";
+		normal_test_items[0].style.display = "none";
+		normal_test_items_add_btn[0].style.display = "none";
+		sensitivity_test_items_add_btn[0].style.display = "none";
+	}else if(special_toggle.val() == 1){
+		normal_test_items[0].style.display = "none";
+		normal_test_items_add_btn[0].style.display = "none";
+		sensitivity_test_items[0].style.display = "none";
+		sensitivity_test_items_add_btn[0].style.display = "none";
+		special_test_items_add_btn[0].style.display = "none";
+	}
+});
diff --git a/erpnext/healthcare/web_form/lab_test/lab_test.json b/erpnext/healthcare/web_form/lab_test/lab_test.json
new file mode 100644
index 0000000..fec34b6
--- /dev/null
+++ b/erpnext/healthcare/web_form/lab_test/lab_test.json
@@ -0,0 +1,235 @@
+{
+ "accept_payment": 0, 
+ "allow_comments": 0, 
+ "allow_delete": 0, 
+ "allow_edit": 1, 
+ "allow_incomplete": 0, 
+ "allow_multiple": 1, 
+ "allow_print": 1, 
+ "amount": 0.0, 
+ "amount_based_on_field": 0, 
+ "creation": "2017-06-06 16:12:33.052258", 
+ "currency": "INR", 
+ "doc_type": "Lab Test", 
+ "docstatus": 0, 
+ "doctype": "Web Form", 
+ "idx": 0, 
+ "introduction_text": "Lab Test", 
+ "is_standard": 1, 
+ "login_required": 1, 
+ "max_attachment_size": 0, 
+ "modified": "2017-06-07 16:03:06.781364", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "lab-test", 
+ "owner": "Administrator", 
+ "payment_button_label": "Buy Now", 
+ "print_format": "Lab Test Print", 
+ "published": 1, 
+ "route": "lab-test", 
+ "show_sidebar": 1, 
+ "sidebar_items": [], 
+ "success_url": "/lab-test", 
+ "title": "Lab Test", 
+ "web_form_fields": [
+  {
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "label": "Series", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "LP-", 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "invoice", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Invoice", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Sales Invoice", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Patient", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Patient", 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "patient_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "label": "Patient Name", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "patient.patient_name", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Doctor", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Physician", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "label": "Status", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Draft\nCompleted\nApproved\nRejected\nCancelled", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "department", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Department", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Medical Department", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "sample", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Sample ID", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Sample Collection", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "default": "", 
+   "fieldname": "result_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "label": "Result Date", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "report_preference", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "label": "Report Preference", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "test_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "label": "Test Name", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "normal_test_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Normal Test Items", 
+   "read_only": 1, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "special_test_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Special Test Items", 
+   "read_only": 1, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "sensitivity_test_items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Sensitivity Test Items", 
+   "read_only": 1, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "test_comment", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "label": "Comments", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 1, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "custom_result", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "label": "Custom Result", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 1, 
+   "reqd": 0
+  }, 
+  {
+   "default": "0", 
+   "fieldname": "sensitivity_toggle", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "default": "0", 
+   "fieldname": "special_toggle", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "default": "0", 
+   "fieldname": "normal_toggle", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/web_form/lab_test/lab_test.py b/erpnext/healthcare/web_form/lab_test/lab_test.py
new file mode 100644
index 0000000..5a8c8a4
--- /dev/null
+++ b/erpnext/healthcare/web_form/lab_test/lab_test.py
@@ -0,0 +1,25 @@
+from __future__ import unicode_literals
+
+import frappe
+
+def get_context(context):
+	context.read_only = 1
+
+def get_list_context(context):
+	context.row_template = "erpnext/templates/includes/healthcare/lab_test_row_template.html"
+	context.get_list = get_lab_test_list
+
+def get_lab_test_list(doctype, txt, filters, limit_start, limit_page_length = 20, order_by='modified desc'):
+	patient = get_patient()
+	lab_tests = frappe.db.sql("""select * from `tabLab Test`
+		where patient = %s order by result_date""", patient, as_dict = True)
+	return lab_tests
+
+def get_patient():
+	return frappe.get_value("Patient",{"email": frappe.session.user}, "name")
+
+def has_website_permission(doc, ptype, user, verbose=False):
+	if doc.patient == get_patient():
+		return True
+	else:
+		return False
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/web_form/patient_appointments/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/web_form/patient_appointments/__init__.py
diff --git a/erpnext/healthcare/web_form/patient_appointments/patient_appointments.js b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.js
new file mode 100644
index 0000000..f09e540
--- /dev/null
+++ b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.js
@@ -0,0 +1,3 @@
+frappe.ready(function() {
+	// bind events here
+});
diff --git a/erpnext/healthcare/web_form/patient_appointments/patient_appointments.json b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.json
new file mode 100644
index 0000000..613e367
--- /dev/null
+++ b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.json
@@ -0,0 +1,111 @@
+{
+ "accept_payment": 0, 
+ "allow_comments": 0, 
+ "allow_delete": 0, 
+ "allow_edit": 1, 
+ "allow_incomplete": 0, 
+ "allow_multiple": 1, 
+ "allow_print": 1, 
+ "amount": 0.0, 
+ "amount_based_on_field": 0, 
+ "creation": "2017-06-07 15:30:44.984832", 
+ "currency": "INR", 
+ "doc_type": "Patient Appointment", 
+ "docstatus": 0, 
+ "doctype": "Web Form", 
+ "idx": 0, 
+ "introduction_text": "Patient Appointments", 
+ "is_standard": 1, 
+ "login_required": 1, 
+ "max_attachment_size": 0, 
+ "modified": "2017-06-07 15:57:27.196428", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "patient-appointments", 
+ "owner": "Administrator", 
+ "payment_button_label": "Buy Now", 
+ "published": 1, 
+ "route": "patient-appointments", 
+ "show_sidebar": 1, 
+ "sidebar_items": [], 
+ "success_url": "/patient-appointments", 
+ "title": "Patient Appointments", 
+ "web_form_fields": [
+  {
+   "fieldname": "patient", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Patient", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Patient", 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Physician", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Physician", 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "appointment_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "label": "Date", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "appointment_time", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "label": "Time", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "department", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Department", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Medical Department", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "appointment_type", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Type", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Appointment Type", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "default": "Scheduled", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "label": "Status", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "\nScheduled\nOpen\nClosed\nPending\nCancelled", 
+   "read_only": 1, 
+   "reqd": 0
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py
new file mode 100644
index 0000000..09bcb42
--- /dev/null
+++ b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py
@@ -0,0 +1,25 @@
+from __future__ import unicode_literals
+
+import frappe
+
+def get_context(context):
+	context.read_only = 1
+
+def get_list_context(context):
+	context.row_template = "erpnext/templates/includes/healthcare/appointment_row_template.html"
+	context.get_list = get_appointment_list
+
+def get_appointment_list(doctype, txt, filters, limit_start, limit_page_length = 20, order_by='modified desc'):
+	patient = get_patient()
+	lab_tests = frappe.db.sql("""select * from `tabPatient Appointment`
+		where patient = %s and (status = 'Open' or status = 'Scheduled') order by appointment_date""", patient, as_dict = True)
+	return lab_tests
+
+def get_patient():
+	return frappe.get_value("Patient",{"email": frappe.session.user}, "name")
+
+def has_website_permission(doc, ptype, user, verbose=False):
+	if doc.patient == get_patient():
+		return True
+	else:
+		return False
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/healthcare/web_form/prescription/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/healthcare/web_form/prescription/__init__.py
diff --git a/erpnext/healthcare/web_form/prescription/prescription.js b/erpnext/healthcare/web_form/prescription/prescription.js
new file mode 100644
index 0000000..f09e540
--- /dev/null
+++ b/erpnext/healthcare/web_form/prescription/prescription.js
@@ -0,0 +1,3 @@
+frappe.ready(function() {
+	// bind events here
+});
diff --git a/erpnext/healthcare/web_form/prescription/prescription.json b/erpnext/healthcare/web_form/prescription/prescription.json
new file mode 100644
index 0000000..5f251a3
--- /dev/null
+++ b/erpnext/healthcare/web_form/prescription/prescription.json
@@ -0,0 +1,112 @@
+{
+ "accept_payment": 0, 
+ "allow_comments": 0, 
+ "allow_delete": 0, 
+ "allow_edit": 1, 
+ "allow_incomplete": 0, 
+ "allow_multiple": 1, 
+ "allow_print": 1, 
+ "amount": 0.0, 
+ "amount_based_on_field": 0, 
+ "creation": "2017-06-06 17:13:19.101374", 
+ "currency": "INR", 
+ "doc_type": "Consultation", 
+ "docstatus": 0, 
+ "doctype": "Web Form", 
+ "idx": 0, 
+ "introduction_text": "Patient Prescriptions", 
+ "is_standard": 1, 
+ "login_required": 1, 
+ "max_attachment_size": 0, 
+ "modified": "2017-06-20 11:56:05.132154", 
+ "modified_by": "Administrator", 
+ "module": "Healthcare", 
+ "name": "prescription", 
+ "owner": "Administrator", 
+ "payment_button_label": "Buy Now", 
+ "print_format": "Consultation Print", 
+ "published": 1, 
+ "route": "prescription", 
+ "show_sidebar": 1, 
+ "sidebar_items": [], 
+ "success_url": "/prescription", 
+ "title": "Prescription", 
+ "web_form_fields": [
+  {
+   "fieldname": "physician", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Doctor", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Physician", 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "visit_department", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Department", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Medical Department", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "default": "Today", 
+   "fieldname": "consultation_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "label": "Consultation Date", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "default": "", 
+   "fieldname": "consultation_time", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "label": "Consultation Time", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "drug_prescription", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "label": "Drug Prescription", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Drug Prescription", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "test_prescription", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "label": "Investigations", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "options": "Lab Prescription", 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "consultation_comment", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "label": "Review Details", 
+   "max_length": 0, 
+   "max_value": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/healthcare/web_form/prescription/prescription.py b/erpnext/healthcare/web_form/prescription/prescription.py
new file mode 100644
index 0000000..73b0350
--- /dev/null
+++ b/erpnext/healthcare/web_form/prescription/prescription.py
@@ -0,0 +1,25 @@
+from __future__ import unicode_literals
+
+import frappe
+
+def get_context(context):
+	context.read_only = 1
+
+def get_list_context(context):
+	context.row_template = "erpnext/templates/includes/healthcare/prescription_row_template.html"
+	context.get_list = get_consultation_list
+
+def get_consultation_list(doctype, txt, filters, limit_start, limit_page_length = 20, order_by='modified desc'):
+	patient = get_patient()
+	consultations = frappe.db.sql("""select * from `tabConsultation`
+		where patient = %s order by creation desc""", patient, as_dict = True)
+	return consultations
+
+def get_patient():
+	return frappe.get_value("Patient",{"email": frappe.session.user}, "name")
+
+def has_website_permission(doc, ptype, user, verbose=False):
+	if doc.patient == get_patient():
+		return True
+	else:
+		return False
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 0e3aa79..8306290 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -128,8 +128,13 @@
 	{"title": _("Shipments"), "route": "/shipments", "reference_doctype": "Delivery Note", "role":"Customer"},
 	{"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role":"Customer"},
 	{"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"},
+	{"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
+	{"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
+	{"title": _("Lab Test"), "route": "/lab-test", "reference_doctype": "Lab Test", "role":"Patient"},
+	{"title": _("Prescription"), "route": "/prescription", "reference_doctype": "Consultation", "role":"Patient"},
+	{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
 	{"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"},
-	{"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"}
+	{"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"}
 ]
 
 default_roles = [
@@ -145,7 +150,10 @@
 	"Supplier Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
 	"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
 	"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
-	"Timesheet": "erpnext.controllers.website_list_for_contact.has_website_permission"
+	"Timesheet": "erpnext.controllers.website_list_for_contact.has_website_permission",
+	"Lab Test": "erpnext.healthcare.web_form.lab_test.lab_test.has_website_permission",
+	"Consultation": "erpnext.healthcare.web_form.prescription.prescription.has_website_permission",
+	"Patient Appointment": "erpnext.healthcare.web_form.patient_appointments.patient_appointments.has_website_permission"
 }
 
 dump_report_map = "erpnext.startup.report_data_map.data_map"
@@ -184,7 +192,7 @@
 
 scheduler_events = {
 	"hourly": [
-		"erpnext.subscription.doctype.subscription.subscription.make_subscription_entry",
+		"erpnext.accounts.doctype.subscription.subscription.make_subscription_entry",
 		'erpnext.hr.doctype.daily_work_summary_settings.daily_work_summary_settings.trigger_emails'
 	],
 	"daily": [
diff --git a/erpnext/hr/doctype/appraisal/test_appraisal.js b/erpnext/hr/doctype/appraisal/test_appraisal.js
index 91da7d3..9ca17e2 100644
--- a/erpnext/hr/doctype/appraisal/test_appraisal.js
+++ b/erpnext/hr/doctype/appraisal/test_appraisal.js
@@ -29,7 +29,7 @@
 		() => frappe.timeout(1),
 		() => cur_frm.set_value('employee',employee_name),
 		() => cur_frm.set_value('employee_name','Test Employee 1'),
-		() => cur_frm.set_value('company','Test Company'),
+		() => cur_frm.set_value('company','For Testing'),
 		() => frappe.click_button('Calculate Total Score'),
 		() => frappe.timeout(1),
 		() => cur_frm.save(),
diff --git a/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js b/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
index 4e245c7..0403cad 100644
--- a/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
+++ b/erpnext/hr/doctype/appraisal_template/test_appraisal_template.js
@@ -20,7 +20,7 @@
 				]},
 			]);
 		},
-		() => frappe.timeout(5),
+		() => frappe.timeout(10),
 		() => {
 			assert.equal('Test Appraisal 1',cur_frm.doc.kra_title, 'Appraisal name correctly set');
 		},
diff --git a/erpnext/hr/doctype/attendance/test_attendance.js b/erpnext/hr/doctype/attendance/test_attendance.js
index 752bf09..8f30e8c 100644
--- a/erpnext/hr/doctype/attendance/test_attendance.js
+++ b/erpnext/hr/doctype/attendance/test_attendance.js
@@ -13,7 +13,7 @@
 		() => assert.equal("Attendance", cur_frm.doctype,
 			"Form for new Attendance opened successfully."),
 		// set values in form
-		() => cur_frm.set_value("company", "Test Company"),
+		() => cur_frm.set_value("company", "For Testing"),
 		() => {
 			frappe.db.get_value('Employee', {'employee_name':'Test Employee 1'}, 'name', function(r) {
 				cur_frm.set_value("employee", r.name)
diff --git a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
index f03c6fa..9ac74aa 100644
--- a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
+++ b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
@@ -51,6 +51,25 @@
 
 			d.sender_name = emp[0].employee_name if emp else d.sender
 			d.image = emp[0].image if emp and emp[0].image else None
+			
+			original_image = d.image
+			# make thumbnail image
+			try:
+				if original_image:
+					file_name = frappe.get_list('File', {'file_url': original_image})
+
+					if file_name:
+						file_name = file_name[0].name
+						file_doc = frappe.get_doc('File', file_name)
+						thumbnail_image = file_doc.make_thumbnail(
+							set_as_thumbnail=False,
+							width=100,
+							height=100,
+							crop=True
+						)
+						d.image = thumbnail_image
+			except:
+				d.image = original_image
 
 			if d.sender in did_not_reply:
 				did_not_reply.remove(d.sender)
diff --git a/erpnext/hr/doctype/employee/test_employee.js b/erpnext/hr/doctype/employee/test_employee.js
index b7f5105..200dcd7 100644
--- a/erpnext/hr/doctype/employee/test_employee.js
+++ b/erpnext/hr/doctype/employee/test_employee.js
@@ -4,14 +4,14 @@
 	assert.expect(4);
 	let done = assert.async();
 	// let today_date = frappe.datetime.nowdate();
-	let employee_creation = (name,joining_date,birth_date) => {
+	let employee_creation = (name, joining_date, birth_date) => {
 		frappe.run_serially([
 		// test employee creation
 			() => {
 				frappe.tests.make('Employee', [
 					{ employee_name: name},
 					{ salutation: 'Mr'},
-					{ company: 'Test Company'},
+					{ company: 'For Testing'},
 					{ date_of_joining: joining_date},
 					{ date_of_birth: birth_date},
 					{ employment_type: 'Test Employment Type'},
@@ -32,9 +32,9 @@
 	};
 	frappe.run_serially([
 		() => employee_creation('Test Employee 1','2017-04-01','1992-02-02'),
-		() => frappe.timeout(6),
+		() => frappe.timeout(10),
 		() => employee_creation('Test Employee 3','2017-04-01','1992-02-02'),
-		() => frappe.timeout(4),
+		() => frappe.timeout(10),
 		() => done()
 	]);
 });
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js b/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
index a24cd1e..2827d4b 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
+++ b/erpnext/hr/doctype/employee_attendance_tool/test_employee_attendance_tool.js
@@ -12,7 +12,7 @@
 			return frappe.tests.make('Employee', [
 				{salutation: "Mr"},
 				{employee_name: "Test Employee 2"},
-				{company: "Test Company"},
+				{company: "For Testing"},
 				{date_of_joining: frappe.datetime.add_months(today_date, -2)},	// joined 2 month from now
 				{date_of_birth: frappe.datetime.add_months(today_date, -240)},	// age is 20 years
 				{employment_type: "Test Employment type"},
@@ -30,7 +30,7 @@
 		() => cur_frm.set_value("date", date_of_attendance),
 		() => cur_frm.set_value("branch", "Test Branch"),
 		() => cur_frm.set_value("department", "Test Department"),
-		() => cur_frm.set_value("company", "Test Company"),
+		() => cur_frm.set_value("company", "For Testing"),
 		() => frappe.timeout(1),
 		() => frappe.click_button('Check all'),
 		() => frappe.click_button('Mark Present'),
@@ -45,7 +45,7 @@
 					filters: {
 						"branch": "Test Branch",
 						"department": "Test Department",
-						"company": "Test Company",
+						"company": "For Testing",
 						"status": "Active"
 					}
 				},
diff --git a/erpnext/hr/doctype/employee_loan/test_employee_loan.js b/erpnext/hr/doctype/employee_loan/test_employee_loan.js
index 9039339..41aad04 100644
--- a/erpnext/hr/doctype/employee_loan/test_employee_loan.js
+++ b/erpnext/hr/doctype/employee_loan/test_employee_loan.js
@@ -15,14 +15,14 @@
 			(r) => {
 				// Creating loan for an employee
 				return frappe.tests.make('Employee Loan', [
-					{ company: 'Test Company'},
+					{ company: 'For Testing'},
 					{ posting_date: '2017-08-26'},
 					{ employee: employee_name},
 					{ employee_loan_application: r.message.name},
 					{ disbursement_date: '2018-08-26'},
 					{ mode_of_payment: 'Cash'},
-					{ employee_loan_account: 'Temporary Opening - TC'},
-					{ interest_income_account: 'Service - TC'}
+					{ employee_loan_account: 'Temporary Opening - FT'},
+					{ interest_income_account: 'Service - FT'}
 				]);
 			},
 			() => frappe.timeout(3),
diff --git a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js b/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
index 72ad915..3e2977e 100644
--- a/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
+++ b/erpnext/hr/doctype/employee_loan_application/test_employee_loan_application.js
@@ -13,7 +13,7 @@
 		},
 		() => {
 			frappe.tests.make('Employee Loan Application', [
-				{ company: 'Test Company'},
+				{ company: 'For Testing'},
 				{ employee: employee_name},
 				{ employee_name: 'Test Employee 1'},
 				{ status: 'Approved'},
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.js b/erpnext/hr/doctype/expense_claim/test_expense_claim.js
index c7c764c..c89eef4 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.js
@@ -30,9 +30,9 @@
 		() => frappe.timeout(1),
 		() => cur_frm.set_value('employee',employee_name),
 		() => cur_frm.set_value('employee_name','Test Employee 1'),
-		() => cur_frm.set_value('company','Test Company'),
-		() => cur_frm.set_value('payable_account','Creditors - TC'),
-		() => cur_frm.set_value('cost_center','Main - TC'),
+		() => cur_frm.set_value('company','For Testing'),
+		() => cur_frm.set_value('payable_account','Creditors - FT'),
+		() => cur_frm.set_value('cost_center','Main - FT'),
 		() => cur_frm.set_value('mode_of_payment','Cash'),
 		() => cur_frm.save(),
 		() => frappe.timeout(1),
diff --git a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
index 595454f..3f9d486 100644
--- a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
+++ b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.js
@@ -11,8 +11,8 @@
 				{ description:'This is just a test'},
 				{ accounts: [
 					[
-						{ company: 'Test Company'},
-						{ default_account: 'Round Off - TC'}
+						{ company: 'For Testing'},
+						{ default_account: 'Round Off - FT'}
 					]
 				]},
 			]);
diff --git a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
index 1241d3d..4537878 100644
--- a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
+++ b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.js
@@ -11,7 +11,7 @@
 		() => frappe.new_doc("Leave Block List"),
 		() => frappe.timeout(1),
 		() => cur_frm.set_value("leave_block_list_name", "Test Leave block list"),
-		() => cur_frm.set_value("company", "Test Company"),
+		() => cur_frm.set_value("company", "For Testing"),
 		() => frappe.click_button('Add Row'),
 		() => {
 			cur_frm.fields_dict.leave_block_list_dates.grid.grid_rows[0].doc.block_date = today_date;
diff --git a/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js
index c92eca3..2b5cec1 100644
--- a/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js
+++ b/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.js
@@ -10,7 +10,7 @@
 		() => frappe.set_route("Form", "Leave Control Panel"),
 		() => frappe.timeout(1),
 		() => cur_frm.set_value("leave_type", "Test Leave type"),
-		() => cur_frm.set_value("company", "Test Company"),
+		() => cur_frm.set_value("company", "For Testing"),
 		() => cur_frm.set_value("employment_type", "Test Employment Type"),
 		() => cur_frm.set_value("branch", "Test Branch"),
 		() => cur_frm.set_value("department", "Test Department"),
@@ -33,7 +33,7 @@
 					filters: {
 						"branch": "Test Branch",
 						"department": "Test Department",
-						"company": "Test Company",
+						"company": "For Testing",
 						"designation": "Test Designation",
 						"status": "Active"
 					}
diff --git a/erpnext/hr/doctype/loan_type/test_loan_type.js b/erpnext/hr/doctype/loan_type/test_loan_type.js
index 8b5032b..71354be 100644
--- a/erpnext/hr/doctype/loan_type/test_loan_type.js
+++ b/erpnext/hr/doctype/loan_type/test_loan_type.js
@@ -15,9 +15,9 @@
 					'This is just a test.'}
 			]);
 		},
-		() => frappe.timeout(3),
+		() => frappe.timeout(7),
 		() => frappe.set_route('List','Loan Type','List'),
-		() => frappe.timeout(2),
+		() => frappe.timeout(4),
 
 		// Checking if the fields are correctly set
 		() => {
diff --git a/erpnext/hr/doctype/process_payroll/test_process_payroll.js b/erpnext/hr/doctype/process_payroll/test_process_payroll.js
index 7e23fb9..bc61150 100644
--- a/erpnext/hr/doctype/process_payroll/test_process_payroll.js
+++ b/erpnext/hr/doctype/process_payroll/test_process_payroll.js
@@ -39,7 +39,7 @@
 		// Creating Process Payroll for specific company
 		() => frappe.set_route('Form','Process Payroll'),
 		() => {
-			cur_frm.set_value('company','Test Company'),
+			cur_frm.set_value('company','For Testing'),
 			frappe.timeout(1),
 			cur_frm.set_value('payroll_frequency','Monthly'),
 			cur_frm.set_value('start_date','2017-08-01'),
diff --git a/erpnext/hr/doctype/salary_structure/test_salary_structure.js b/erpnext/hr/doctype/salary_structure/test_salary_structure.js
index 23b52f6..8276a82 100644
--- a/erpnext/hr/doctype/salary_structure/test_salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/test_salary_structure.js
@@ -3,17 +3,17 @@
 	let done = assert.async();
 	let employee_name1;
 
-	let salary_structure = (ename1,ename2) => {
-		frappe.run_serially([
-			() => frappe.db.get_value('Employee', {'employee_name': ename1}, 'name'),
+	frappe.run_serially([
+		() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 1"}, 'name',
 			(r) => {
-				employee_name1 = r.message.name;
-			},
-			() => frappe.db.get_value('Employee', {'employee_name': ename2}, 'name'),
+				employee_name1 = r.name;
+			}
+		),
+		() => frappe.db.get_value('Employee', {'employee_name': "Test Employee 3"}, 'name',
 			(r) => {
 			// Creating Salary Structure for employees);
-				frappe.tests.make('Salary Structure', [
-					{ company: 'Test Company'},
+				return frappe.tests.make('Salary Structure', [
+					{ company: 'For Testing'},
 					{ payroll_frequency: 'Monthly'},
 					{ employees: [
 						[
@@ -22,7 +22,7 @@
 							{base: 25000}
 						],
 						[
-							{employee: r.message.name},
+							{employee: r.name},
 							{from_date: '2017-07-01'},
 							{base: 30000}
 						]
@@ -43,39 +43,36 @@
 							{formula: '(B+LE) * .20'}
 						]
 					]},
-					{ payment_account: 'CASH - TC'},
+					{ payment_account: 'CASH - FT'},
 				]);
-			},
-			() => frappe.timeout(10),
-			() => cur_dialog.set_value('value','Test Salary Structure'),
-			() => frappe.timeout(2),
-			() => frappe.click_button('Create'),
-			() => {
-			// To check if all the fields are correctly set
-				assert.ok(cur_frm.doc.employees[0].employee_name.includes('Test Employee 1') &&
-					cur_frm.doc.employees[1].employee_name.includes('Test Employee 3'),
-				'Employee names are correctly set');
+			}
+		),
+		() => frappe.timeout(18),
+		() => cur_dialog.set_value('value','Test Salary Structure'),
+		() => frappe.timeout(1),
+		() => frappe.click_button('Create'),
+		() => frappe.timeout(1),
+		() => {
+		// To check if all the fields are correctly set
+			assert.ok(cur_frm.doc.employees[0].employee_name.includes('Test Employee 1') &&
+				cur_frm.doc.employees[1].employee_name.includes('Test Employee 3'),
+			'Employee names are correctly set');
 
-				assert.ok(cur_frm.doc.employees[0].base==25000,
-					'Base value for first employee is correctly set');
+			assert.ok(cur_frm.doc.employees[0].base==25000,
+				'Base value for first employee is correctly set');
 
-				assert.ok(cur_frm.doc.employees[1].base==30000,
-					'Base value for second employee is correctly set');
+			assert.ok(cur_frm.doc.employees[1].base==30000,
+				'Base value for second employee is correctly set');
 
-				assert.ok(cur_frm.doc.earnings[0].formula.includes('base * .80'),
-					'Formula for earnings as Basic is correctly set');
+			assert.ok(cur_frm.doc.earnings[0].formula.includes('base * .80'),
+				'Formula for earnings as Basic is correctly set');
 
-				assert.ok(cur_frm.doc.earnings[1].formula.includes('B * .20'),
-					'Formula for earnings as Leave Encashment is correctly set');
+			assert.ok(cur_frm.doc.earnings[1].formula.includes('B * .20'),
+				'Formula for earnings as Leave Encashment is correctly set');
 
-				assert.ok(cur_frm.doc.deductions[0].formula.includes('(B+LE) * .20'),
-					'Formula for deductions as Income Tax is correctly set');
-			},
-		]);
-	};
-	frappe.run_serially([
-		() => salary_structure('Test Employee 1','Test Employee 3'),
-		() => frappe.timeout(16),
+			assert.ok(cur_frm.doc.deductions[0].formula.includes('(B+LE) * .20'),
+				'Formula for deductions as Income Tax is correctly set');
+		},
 		() => done()
 	]);
-});
\ No newline at end of file
+});
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index 32c357f..531da8a 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -22,7 +22,7 @@
 		frm.set_query("source_warehouse", "items", function() {
 			return {
 				filters: {
-					'company': frm.doc.company,
+					'company': frm.doc.company
 				}
 			};
 		});
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index bf5fef5..b308e09 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -531,19 +531,20 @@
 				and item.name = bom_item.item_code
 				and is_stock_item = 1
 				{where_conditions}
-				group by item_code, stock_uom"""
+				group by item_code, stock_uom
+				order by idx"""
 
 	if fetch_exploded:
 		query = query.format(table="BOM Explosion Item",
 			where_conditions="""and item.is_sub_contracted_item = 0""",
-			select_columns = ", bom_item.source_warehouse")
-		items = frappe.db.sql(query, { "qty": qty,	"bom": bom }, as_dict=True)
+			select_columns = ", bom_item.source_warehouse, (Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s ) as idx")
+		items = frappe.db.sql(query, { "parent": bom, "qty": qty,	"bom": bom }, as_dict=True)
 	elif fetch_scrap_items:
-		query = query.format(table="BOM Scrap Item", where_conditions="", select_columns="")
+		query = query.format(table="BOM Scrap Item", where_conditions="", select_columns=", bom_item.idx")
 		items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
 	else:
 		query = query.format(table="BOM Item", where_conditions="",
-			select_columns = ", bom_item.source_warehouse")
+			select_columns = ", bom_item.source_warehouse, bom_item.idx")
 		items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
 
 	for item in items:
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.js b/erpnext/manufacturing/doctype/bom/test_bom.js
index 80a4ede..5044a28 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.js
+++ b/erpnext/manufacturing/doctype/bom/test_bom.js
@@ -12,7 +12,7 @@
 				{item: "Laptop"},
 				{quantity: 1},
 				{with_operations: 1},
-				{company: "Razer Blade"},
+				{company: "For Testing"},
 				{operations: [
 					[
 						{operation: "Assemble CPU"},
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 5fedc72..1147570 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -367,15 +367,11 @@
 				frappe.throw(_("Completed Qty can not be greater than 'Qty to Manufacture'"))
 
 	def set_actual_dates(self):
+		self.actual_start_date = None
+		self.actual_end_date = None
 		if self.get("operations"):
-			actual_date = frappe.db.sql("""select min(actual_start_time) as start_date,
-				max(actual_end_time) as end_date from `tabProduction Order Operation`
-				where parent = %s and docstatus=1""", self.name, as_dict=1)[0]
-			self.actual_start_date = actual_date.start_date
-			self.actual_end_date = actual_date.end_date
-		else:
-			self.actual_start_date = None
-			self.actual_end_date = None
+			self.actual_start_date = min([d.actual_start_time for d in self.get("operations")])
+			self.actual_end_date = max([d.actual_end_time for d in self.get("operations")])
 
 	def delete_timesheet(self):
 		for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}):
@@ -437,7 +433,7 @@
 			item_dict = get_bom_items_as_dict(self.bom_no, self.company, qty=self.qty,
 				fetch_exploded = self.use_multi_level_bom)
 
-			for item in item_dict.values():
+			for item in sorted(item_dict.values(), key=lambda d: d['idx']):
 				self.append('required_items', {
 					'item_code': item.item_code,
 					'required_qty': item.qty,
diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.js b/erpnext/manufacturing/doctype/production_order/test_production_order.js
index a1e910a..7ce67ba 100644
--- a/erpnext/manufacturing/doctype/production_order/test_production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/test_production_order.js
@@ -2,7 +2,7 @@
 	assert.expect(25);
 	let done = assert.async();
 	let laptop_quantity = 5;
-	let items = ["Screen", "CPU", "Keyboard"];
+	let items = ["CPU", "Keyboard", "Screen"];
 	let operation_items = ["CPU", "Keyboard", "Screen"];
 	let click_make = () => {
 		let element = $(`.btn-primary:contains("Make"):visible`);
@@ -19,22 +19,17 @@
 		() => frappe.timeout(0.5),
 
 		// Create a laptop production order
-		() => frappe.new_doc("Production Order"),
-		() => frappe.timeout(1),
-		() => cur_frm.set_value("production_item", "Laptop"),
+		() => {
+			return frappe.tests.make('Production Order', [
+				{production_item: 'Laptop'},
+				{company: 'For Testing'},
+				{qty: laptop_quantity},
+				{scrap_warehouse: "Laptop Scrap Warehouse - FT"},
+				{wip_warehouse: "Work In Progress - FT"},
+				{fg_warehouse: "Finished Goods - FT"}
+			]);
+		},
 		() => frappe.timeout(2),
-		() => cur_frm.set_value("company", "Razer Blade"),
-		() => frappe.timeout(2),
-		() => cur_frm.set_value("qty", laptop_quantity),
-		() => frappe.timeout(2),
-		() => cur_frm.set_value("scrap_warehouse", "Laptop Scrap Warehouse - RB"),
-		() => frappe.timeout(1),
-		() => cur_frm.set_value("wip_warehouse", "Work In Progress - RB"),
-		() => frappe.timeout(1),
-		() => cur_frm.set_value("fg_warehouse", "Finished Goods - RB"),
-		() => cur_frm.save(),
-		() => frappe.timeout(2),
-
 		() => {
 			assert.equal(cur_frm.doc.planned_operating_cost, cur_frm.doc.total_operating_cost,
 				"Total and Planned Cost is equal");
@@ -43,7 +38,7 @@
 
 			items.forEach(function(item, index) {
 				assert.equal(item, cur_frm.doc.required_items[index].item_code, `Required item ${item} added`);
-				assert.equal("Stores - RB", cur_frm.doc.required_items[index].source_warehouse, `Item ${item} warhouse verified`);
+				assert.equal("Stores - FT", cur_frm.doc.required_items[index].source_warehouse, `Item ${item} warhouse verified`);
 				assert.equal("5", cur_frm.doc.required_items[index].required_qty, `Item ${item} quantity verified`);
 			});
 
@@ -73,7 +68,7 @@
 
 		// Start the production order process
 		() => frappe.set_route("List", "Production Order"),
-		() => frappe.timeout(2),
+		() => frappe.timeout(.5),
 		() => frappe.set_route("List", "Production Order"),
 		() => frappe.timeout(2),
 		() => frappe.click_link("Laptop"),
@@ -81,6 +76,7 @@
 		() => frappe.click_button("Start"),
 		() => frappe.timeout(0.5),
 		() => click_make(),
+		() => frappe.timeout(1),
 		() => frappe.click_button("Save"),
 		() => frappe.timeout(0.5),
 
diff --git a/erpnext/modules.txt b/erpnext/modules.txt
index 0579cc2..04344a0 100644
--- a/erpnext/modules.txt
+++ b/erpnext/modules.txt
@@ -15,4 +15,4 @@
 Maintenance
 Schools
 Regional
-Subscription
\ No newline at end of file
+Healthcare
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2a2051e..8411a7d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -436,10 +436,15 @@
 erpnext.patches.v8_7.fix_purchase_receipt_status
 erpnext.patches.v8_6.rename_bom_update_tool
 erpnext.patches.v8_7.set_offline_in_pos_settings #11-09-17
-erpnext.patches.v8_9.add_setup_progress_actions
+erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017
 erpnext.patches.v8_9.rename_company_sales_target_field
 erpnext.patches.v8_8.set_bom_rate_as_per_uom
+erpnext.patches.v9_0.remove_subscription_module
 erpnext.patches.v8_7.make_subscription_from_recurring_data
+erpnext.patches.v8_9.set_print_zero_amount_taxes
+erpnext.patches.v8_9.set_default_customer_group
+erpnext.patches.v8_9.remove_employee_from_salary_structure_parent
+erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts
 erpnext.patches.v8_10.add_due_date_to_gle
 erpnext.patches.v8_10.update_gl_due_date_for_pi_and_si
 erpnext.patches.v8_10.add_payment_terms_field_to_supplier
diff --git a/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py b/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py
index 321b039..39b7f6c 100644
--- a/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py
+++ b/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py
@@ -30,7 +30,7 @@
 		.format(', '.join(['%s']*len(modified_items))), tuple(modified_items)))
 	
 	item_warehouses_with_transactions += list(frappe.db.sql("""
-		select distinct pr_item.item_code, pr.source_warehouse 
+		select distinct pr_item.item_code, pr_item.source_warehouse 
 		from `tabProduction Order` pr, `tabProduction Order Item` pr_item 
 		where pr_item.parent and pr.name and pr.docstatus=1 and pr_item.item_code in ({0})"""
 		.format(', '.join(['%s']*len(modified_items))), tuple(modified_items)))
diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py
index 5660693..f329916 100644
--- a/erpnext/patches/v8_1/setup_gst_india.py
+++ b/erpnext/patches/v8_1/setup_gst_india.py
@@ -2,21 +2,25 @@
 from frappe.email import sendmail_to_system_managers
 
 def execute():
-	frappe.reload_doc('regional', 'doctype', 'gst_settings')
-	frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
 	frappe.reload_doc('stock', 'doctype', 'item')
 	frappe.reload_doc("stock", "doctype", "customs_tariff_number")
 
+	company = frappe.get_all('Company', filters = {'country': 'India'})
+	if not company:
+		return
+
+	frappe.reload_doc('regional', 'doctype', 'gst_settings')
+	frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
+
 	for report_name in ('GST Sales Register', 'GST Purchase Register',
 		'GST Itemised Sales Register', 'GST Itemised Purchase Register'):
 
 		frappe.reload_doc('regional', 'report', frappe.scrub(report_name))
 
-	if frappe.db.get_single_value('System Settings', 'country')=='India':
-		from erpnext.regional.india.setup import setup
-		delete_custom_field_tax_id_if_exists()
-		setup(patch=True)
-		send_gst_update_email()
+	from erpnext.regional.india.setup import setup
+	delete_custom_field_tax_id_if_exists()
+	setup(patch=True)
+	send_gst_update_email()
 
 def delete_custom_field_tax_id_if_exists():
 	for field in frappe.db.sql_list("""select name from `tabCustom Field` where fieldname='tax_id'
diff --git a/erpnext/patches/v8_7/make_subscription_from_recurring_data.py b/erpnext/patches/v8_7/make_subscription_from_recurring_data.py
index 03d8eb4..ab0fc12 100644
--- a/erpnext/patches/v8_7/make_subscription_from_recurring_data.py
+++ b/erpnext/patches/v8_7/make_subscription_from_recurring_data.py
@@ -6,7 +6,7 @@
 from frappe.utils import today
 
 def execute():
-	frappe.reload_doc('subscription', 'doctype', 'subscription')
+	frappe.reload_doc('accounts', 'doctype', 'subscription')
 	frappe.reload_doc('selling', 'doctype', 'sales_order')
 	frappe.reload_doc('buying', 'doctype', 'purchase_order')
 	frappe.reload_doc('accounts', 'doctype', 'sales_invoice')
@@ -18,10 +18,10 @@
 			make_subscription(doctype, data)
 
 def get_data(doctype):
-	return frappe.db.sql(""" select name, from_date, end_date, recurring_type,recurring_id
+	return frappe.db.sql(""" select name, from_date, end_date, recurring_type,recurring_id,
 		next_date, notify_by_email, notification_email_address, recurring_print_format,
-		repeat_on_day_of_month, submit_on_creation
-		from `tab{0}` where is_recurring = 1 and next_date >= %s
+		repeat_on_day_of_month, submit_on_creation, docstatus
+		from `tab{0}` where is_recurring = 1 and next_date >= %s and docstatus < 2
 	""".format(doctype), today(), as_dict=1)
 
 def make_subscription(doctype, data):
@@ -39,7 +39,5 @@
 		'submit_on_creation': data.submit_on_creation
 	}).insert(ignore_permissions=True)
 
-	doc.submit()
-
-	if not doc.subscription:
-		frappe.db.set_value(doctype, data.name, "subscription", doc.name)
\ No newline at end of file
+	if data.docstatus == 1:
+		doc.submit()
\ No newline at end of file
diff --git a/erpnext/patches/v8_9/__init__.py b/erpnext/patches/v8_9/__init__.py
index e69de29..8b13789 100644
--- a/erpnext/patches/v8_9/__init__.py
+++ b/erpnext/patches/v8_9/__init__.py
@@ -0,0 +1 @@
+
diff --git a/erpnext/patches/v8_9/add_setup_progress_actions.py b/erpnext/patches/v8_9/add_setup_progress_actions.py
index 25698cc..97d2d14 100644
--- a/erpnext/patches/v8_9/add_setup_progress_actions.py
+++ b/erpnext/patches/v8_9/add_setup_progress_actions.py
@@ -11,6 +11,10 @@
 	actions = [
 		{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
 			"domains": '[]' },
+		{"action_name": _("Set Sales Target"), "action_doctype": "Company", "min_doc_count": 99,
+			"action_document": frappe.defaults.get_defaults().get("company") or '',
+			"action_field": "monthly_sales_target", "is_completed": 0,
+			"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
 		{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
 			"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
 		{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
@@ -30,6 +34,7 @@
 	]
 
 	setup_progress = frappe.get_doc("Setup Progress", "Setup Progress")
+	setup_progress.actions = []
 	for action in actions:
 		setup_progress.append("actions", action)
 
diff --git a/erpnext/patches/v8_9/delete_gst_doctypes_for_outside_india_accounts.py b/erpnext/patches/v8_9/delete_gst_doctypes_for_outside_india_accounts.py
new file mode 100644
index 0000000..2b4ac58
--- /dev/null
+++ b/erpnext/patches/v8_9/delete_gst_doctypes_for_outside_india_accounts.py
@@ -0,0 +1,13 @@
+import frappe
+
+def execute():
+	company = frappe.get_all('Company', filters = {'country': 'India'})
+	if not company:
+		if frappe.db.exists("DocType", "GST Settings"):
+			frappe.delete_doc("DocType", "GST Settings")
+			frappe.delete_doc("DocType", "GST HSN Code")
+		
+			for report_name in ('GST Sales Register', 'GST Purchase Register',
+				'GST Itemised Sales Register', 'GST Itemised Purchase Register'):
+
+				frappe.delete_doc('Report', report_name)
\ No newline at end of file
diff --git a/erpnext/patches/v8_9/remove_employee_from_salary_structure_parent.py b/erpnext/patches/v8_9/remove_employee_from_salary_structure_parent.py
new file mode 100644
index 0000000..4ab9cf3
--- /dev/null
+++ b/erpnext/patches/v8_9/remove_employee_from_salary_structure_parent.py
@@ -0,0 +1,5 @@
+import frappe
+
+def execute():
+	if 'employee' in frappe.db.get_table_columns("Salary Structure"):
+		frappe.db.sql("alter table `tabSalary Structure` drop column employee")
diff --git a/erpnext/patches/v8_9/set_default_customer_group.py b/erpnext/patches/v8_9/set_default_customer_group.py
new file mode 100644
index 0000000..b121998
--- /dev/null
+++ b/erpnext/patches/v8_9/set_default_customer_group.py
@@ -0,0 +1,6 @@
+import frappe
+
+def execute():
+	selling_settings = frappe.get_single('Selling Settings')
+	selling_settings.set_default_customer_group_and_territory()
+	selling_settings.save()
diff --git a/erpnext/patches/v8_9/set_print_zero_amount_taxes.py b/erpnext/patches/v8_9/set_print_zero_amount_taxes.py
new file mode 100644
index 0000000..33d3ced
--- /dev/null
+++ b/erpnext/patches/v8_9/set_print_zero_amount_taxes.py
@@ -0,0 +1,7 @@
+from __future__ import unicode_literals
+import frappe
+
+from erpnext.setup.install import create_print_zero_amount_taxes_custom_field
+
+def execute():
+	create_print_zero_amount_taxes_custom_field()
\ No newline at end of file
diff --git a/erpnext/patches/v9_0/__init__.py b/erpnext/patches/v9_0/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/erpnext/patches/v9_0/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/patches/v9_0/remove_subscription_module.py b/erpnext/patches/v9_0/remove_subscription_module.py
new file mode 100644
index 0000000..493873f
--- /dev/null
+++ b/erpnext/patches/v9_0/remove_subscription_module.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	if frappe.db.exists('Module Def', 'Subscription'):
+		frappe.db.sql(""" delete from `tabModule Def` where name = 'Subscription'""")
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index f16cf07..5af8410 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.ui.form.on("Project", {
-	onload: function(frm) {
+	setup: function(frm) {
 		frm.set_indicator_formatter('title',
 			function(doc) {
 				let indicator = 'orange';
@@ -18,7 +18,9 @@
 				return indicator;
 			}
 		);
+	},
 
+	onload: function(frm) {
 		var so = frappe.meta.get_docfield("Project", "sales_order");
 		so.get_route_options_for_new_doc = function(field) {
 			if(frm.is_new()) return;
@@ -113,4 +115,3 @@
 		frm.trigger('tasks_refresh');
 	},
 });
-
diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js
index 62ae1ed..ba1414c 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.js
+++ b/erpnext/projects/doctype/timesheet/timesheet.js
@@ -58,7 +58,7 @@
 
 	make_invoice: function(frm) {
 		let dialog = new frappe.ui.Dialog({
-			title: __("For Item"),
+			title: __("Select Item (optional)"),
 			fields: [
 				{"fieldtype": "Link", "label": __("Item Code"), "fieldname": "item_code", "options":"Item"},
 				{"fieldtype": "Link", "label": __("Customer"), "fieldname": "customer", "options":"Customer"}
diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css
index 13fdcf1..460efbf 100644
--- a/erpnext/public/css/erpnext.css
+++ b/erpnext/public/css/erpnext.css
@@ -356,3 +356,12 @@
   border-radius: 3px;
   color: #fff;
 }
+.leaderboard .result {
+  border-top: 1px solid #d1d8dd;
+}
+.leaderboard .list-item {
+  padding-left: 45px;
+}
+.leaderboard .list-item_content {
+  padding-right: 45px;
+}
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index d042bb7..e45c35e 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -155,7 +155,7 @@
 			});
 
 			if(cumulated_tax_fraction && !me.discount_amount_applied) {
-				item.net_amount = flt(item.amount / (1 + cumulated_tax_fraction), precision("net_amount", item));
+				item.net_amount = flt(item.amount / (1 + cumulated_tax_fraction));
 				item.net_rate = flt(item.net_amount / item.qty, precision("net_rate", item));
 
 				me.set_in_company_currency(item, ["net_rate", "net_amount"]);
@@ -211,6 +211,7 @@
 
 	calculate_taxes: function() {
 		var me = this;
+		this.frm.doc.rounding_adjustment = 0;
 		var actual_tax_dict = {};
 
 		// maintain actual tax rate based on idx
@@ -277,8 +278,10 @@
 
 					// adjust Discount Amount loss in last tax iteration
 					if ((i == me.frm.doc["taxes"].length - 1) && me.discount_amount_applied
-							&& me.frm.doc.apply_discount_on == "Grand Total" && me.frm.doc.discount_amount)
-						me.adjust_discount_amount_loss(tax);
+						&& me.frm.doc.apply_discount_on == "Grand Total" && me.frm.doc.discount_amount) {
+						me.frm.doc.rounding_adjustment = flt(me.frm.doc.grand_total -
+							flt(me.frm.doc.discount_amount) - tax.total, precision("rounding_adjustment"));
+					}
 				}
 			});
 		});
@@ -339,45 +342,41 @@
 		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, precision("tax_amount", tax));
 	},
 
-	adjust_discount_amount_loss: function(tax) {
-		var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.discount_amount) - tax.total;
-		tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
-			discount_amount_loss, precision("tax_amount", tax));
-		tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
-
-		this.set_in_company_currency(tax, ["total", "tax_amount_after_discount_amount"]);
-	},
-
 	manipulate_grand_total_for_inclusive_tax: function() {
 		var me = this;
 		// if fully inclusive taxes and diff
 		if (this.frm.doc["taxes"] && this.frm.doc["taxes"].length) {
-			var all_inclusive = frappe.utils.all(this.frm.doc["taxes"].map(function(d) {
-				return cint(d.included_in_print_rate);
-			}));
-
-			if (all_inclusive) {
+			var any_inclusive_tax = false;
+			$.each(this.frm.doc.taxes || [], function(i, d) {
+				if(cint(d.included_in_print_rate)) any_inclusive_tax = true;
+			});
+			if (any_inclusive_tax) {
 				var last_tax = me.frm.doc["taxes"].slice(-1)[0];
+				var non_inclusive_tax_amount = frappe.utils.sum($.map(this.frm.doc.taxes || [],
+					function(d) {
+						if(!d.included_in_print_rate) {
+							return flt(d.tax_amount_after_discount_amount);
+						}
+					}
+				));
+				var diff = me.frm.doc.total + non_inclusive_tax_amount
+					- flt(last_tax.total, precision("grand_total"));
 
-				var diff = me.frm.doc.total - flt(last_tax.total, precision("grand_total"));
-
-				if ( diff && Math.abs(diff) <= (2.0 / Math.pow(10, precision("tax_amount", last_tax))) ) {
-					last_tax.tax_amount += diff;
-					last_tax.tax_amount_after_discount += diff;
-					last_tax.total += diff;
-
-					this.set_in_company_currency(last_tax,
-						["total", "tax_amount", "tax_amount_after_discount_amount"]);
+				if ( diff && Math.abs(diff) <= (5.0 / Math.pow(10, precision("tax_amount", last_tax))) ) {
+					this.frm.doc.rounding_adjustment = flt(flt(this.frm.doc.rounding_adjustment) + diff,
+						precision("rounding_adjustment"));
 				}
 			}
 		}
 	},
 
 	calculate_totals: function() {
-		// Changing sequence can cause roundiing issue and on-screen discrepency
+		// Changing sequence can cause rounding_adjustmentng issue and on-screen discrepency
 		var me = this;
 		var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0;
-		this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
+		this.frm.doc.grand_total = flt(tax_count
+			? this.frm.doc["taxes"][tax_count - 1].total + flt(this.frm.doc.rounding_adjustment)
+			: this.frm.doc.net_total);
 
 		if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) {
 			this.frm.doc.base_grand_total = (this.frm.doc.total_taxes_and_charges) ?
@@ -396,24 +395,30 @@
 					}
 				});
 
-				frappe.model.round_floats_in(this.frm.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"]);
+				frappe.model.round_floats_in(this.frm.doc,
+					["taxes_and_charges_added", "taxes_and_charges_deducted"]);
 			}
 
 			this.frm.doc.base_grand_total = flt((this.frm.doc.taxes_and_charges_added || this.frm.doc.taxes_and_charges_deducted) ?
 				flt(this.frm.doc.grand_total * this.frm.doc.conversion_rate) : this.frm.doc.base_net_total);
 
-			this.set_in_company_currency(this.frm.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"]);
+			this.set_in_company_currency(this.frm.doc,
+				["taxes_and_charges_added", "taxes_and_charges_deducted"]);
 		}
 
-		this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
-			precision("total_taxes_and_charges"));
+		this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total - this.frm.doc.net_total
+			- flt(this.frm.doc.rounding_adjustment), precision("total_taxes_and_charges"));
 
-		this.set_in_company_currency(this.frm.doc, ["total_taxes_and_charges"]);
+		this.set_in_company_currency(this.frm.doc, ["total_taxes_and_charges", "rounding_adjustment"]);
 
 		// Round grand total as per precision
 		frappe.model.round_floats_in(this.frm.doc, ["grand_total", "base_grand_total"]);
 
 		// rounded totals
+		this.set_rounded_total()
+	},
+
+	set_rounded_total: function() {
 		if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
 			this.frm.doc.rounded_total = round_based_on_smallest_currency_fraction(this.frm.doc.grand_total,
 				this.frm.doc.currency, precision("rounded_total"));
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index f3db267..82a4bd1 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -664,30 +664,32 @@
 			"base_discount_amount", "base_grand_total", "base_rounded_total", "base_in_words",
 			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted", "total_amount_to_pay",
 			"base_paid_amount", "base_write_off_amount", "base_change_amount", "base_operating_cost",
-			"base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"
-		], company_currency);
+			"base_raw_material_cost", "base_total_cost", "base_scrap_material_cost",
+			"base_rounding_adjustment"], company_currency);
 
 		this.frm.set_currency_labels(["total", "net_total", "total_taxes_and_charges", "discount_amount",
 			"grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted",
-			"rounded_total", "in_words", "paid_amount", "write_off_amount", "operating_cost", "scrap_material_cost",
-			"raw_material_cost", "total_cost"], this.frm.doc.currency);
+			"rounded_total", "in_words", "paid_amount", "write_off_amount", "operating_cost",
+			"scrap_material_cost", "rounding_adjustment", "raw_material_cost",
+			"total_cost"], this.frm.doc.currency);
 
-		this.frm.set_currency_labels(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency);
+		this.frm.set_currency_labels(["outstanding_amount", "total_advance"],
+			this.frm.doc.party_account_currency);
 
 		cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
-			+ " = [?] " + company_currency)
+			+ " = [?] " + company_currency);
 
 		if(this.frm.doc.price_list_currency && this.frm.doc.price_list_currency!=company_currency) {
-			cur_frm.set_df_property("plc_conversion_rate", "description", "1 " + this.frm.doc.price_list_currency
-				+ " = [?] " + company_currency)
+			cur_frm.set_df_property("plc_conversion_rate", "description", "1 "
+				+ this.frm.doc.price_list_currency + " = [?] " + company_currency);
 		}
 
 		// toggle fields
-		this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_total_taxes_and_charges",
-			"base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
+		this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total",
+			"base_total_taxes_and_charges", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
 			"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount",
-			"base_paid_amount", "base_write_off_amount", "base_operating_cost",
-			"base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"],
+			"base_paid_amount", "base_write_off_amount", "base_operating_cost", "base_raw_material_cost",
+			"base_total_cost", "base_scrap_material_cost", "base_rounding_adjustment"],
 			this.frm.doc.currency != company_currency);
 
 		this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
diff --git a/erpnext/public/js/schools/assessment_result_tool.html b/erpnext/public/js/schools/assessment_result_tool.html
index 3c09ccd..9fc17f7 100644
--- a/erpnext/public/js/schools/assessment_result_tool.html
+++ b/erpnext/public/js/schools/assessment_result_tool.html
@@ -1,44 +1,72 @@
 <table class="table table-bordered assessment-result-tool">
-    <thead>
-        <tr>
-            <th style="width: 100px" rowspan="2">Student</th>
-            <th style="width: 200px" rowspan="2">Student Name</th>
-            {% for c in criteria %}
-            <th class="score" style="width: 100px">{{ c.assessment_criteria }}</th>
-            {% endfor %}
-            <th class="score" style="width: 100px">Total Marks</th>
-            <!--criteria-->
-        </tr>
-        <tr>
-            {% for c in criteria %}
-            <th class="score" style="width: 100px">{{ c.maximum_score }}</th>
-            {% endfor %}
-            <th class="score" style="width: 100px">{{max_total_score}}</th>
-        </tr>
-    </thead>
-    <tbody>
-        {% for s in students %}
-        <tr 
-            {% if(s.assessment_details) { %} class="text-muted" {% } %}
-            data-student="{{s.student}}">
-            <td>{{ s.student }}</td>
-            <td>{{ s.student_name }}</td>
-            {% for c in criteria %}
-            <td>
-                <input type="text"
-                    data-max-score="{{c.maximum_score}}"
-                    data-criteria="{{c.assessment_criteria}}"
-                    data-student="{{s.student}}"
-                    {% if(s.assessment_details) { %}
-                        disabled
-                        value="{{s.assessment_details[c.assessment_criteria]}}"
-                    {% } %}/>
-            </td>
-            {% endfor %}
-            <td data-student="{{s.student}}" class="total-score">
-                {% if(s.assessment_details) { %} {{s.assessment_details.total_score}} {% } %}
-            </td>
-        </tr>
-        {% endfor %}
-    </tbody>
+	<thead>
+		<tr>
+			<th style="width: 90px" rowspan="2">Student</th>
+			<th style="width: 170px" rowspan="2">Student Name</th>
+			{% for c in criteria %}
+			<th class="score" style="width: 100px">{{ c.assessment_criteria }}</th>
+			{% endfor %}
+			<th class="score" style="width: 170px" rowspan="2">Comments</th>
+			<th class="score" style="width: 100px">Total Marks</th>
+			<!--criteria-->
+		</tr>
+		<tr>
+			{% for c in criteria %}
+			<th class="score" style="width: 100px">Score ({{ c.maximum_score }})</th>
+			{% endfor %}
+			<th class="score" style="width: 100px">Score ({{max_total_score}})</th>
+		</tr>
+	</thead>
+	<tbody>
+		{% for s in students %}
+		<tr 
+			{% if(s.assessment_details && s.docstatus && s.docstatus == 1) { %} class="text-muted" {% } %}
+			data-student="{{s.student}}">
+
+			<td>{{ s.student }}</td>
+			<td>{{ s.student_name }}</td>
+			{% for c in criteria %}
+			<td>
+				<span data-student="{{s.student}}" data-criteria="{{c.assessment_criteria}}" class="student-result-grade badge" >
+					{% if(s.assessment_details) { %}
+						{{s.assessment_details[c.assessment_criteria][1]}} 
+					{% } %}
+				</span>
+				<input type="number" class="student-result-data" style="width:70%; float:right;"
+					data-max-score="{{c.maximum_score}}"
+					data-criteria="{{c.assessment_criteria}}"
+					data-student="{{s.student}}"
+					{% if(s.assessment_details && s.docstatus && s.docstatus == 1) { %} disabled {% } %}
+					{% if(s.assessment_details) { %}
+						value="{{s.assessment_details[c.assessment_criteria][0]}}"
+					{% } %}/>
+			</td>
+			{% endfor %}
+			<td>
+				<input type="text" class="result-comment" data-student="{{s.student}}"
+				{% if(s.assessment_details && s.docstatus && s.docstatus == 1) { %} disabled {% } %}
+				{% if(s.assessment_details) { %}
+					value="{{s.assessment_details.comment}}"
+				{% } %}
+			</td>
+			<td>
+				<span data-student="{{s.student}}" class="total-score-grade badge" style="width:30%; float:left;">
+				{% if(s.assessment_details) { %}
+				{{s.assessment_details.total_score[1]}}
+				{% } %}
+				</span>
+				<span data-student="{{s.student}}" class="total-score" style="width:60%; float:center;">
+				{% if(s.assessment_details) { %}
+				{{s.assessment_details.total_score[0]}}
+				{% } %}
+				</span>
+				<span data-student="{{s.student}}" class="total-result-link" style="width: 10%; display:{% if(!s.assessment_details) { %}None{% } %}; float:right;">
+					<a class="btn-open no-decoration" title="Open Link" href="#Form/Assessment Result/{% if(s.assessment_details) { %}{{s.name}}{% } %}">
+						<i class="octicon octicon-arrow-right"></i>
+					</a>
+				</span>
+			</td>
+		</tr>
+		{% endfor %}
+	</tbody>
 </table>
\ No newline at end of file
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 320d871..88178f4 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -25,7 +25,8 @@
 					{ "label": __("Manufacturing"), "value": "Manufacturing" },
 					{ "label": __("Retail"), "value": "Retail" },
 					{ "label": __("Services"), "value": "Services" },
-					{ "label": __("Education"), "value": "Education" }
+					{ "label": __("Education (beta)"), "value": "Education" },
+					{"label": __("Healthcare (beta)"), "value": "Healthcare"}
 				], reqd: 1
 			},
 		],
@@ -134,12 +135,10 @@
 				frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
 				return false;
 			}
-
 			if ((this.values.company_name || "").toLowerCase() == "company") {
 				frappe.msgprint(__("Company Name cannot be Company"));
 				return false;
 			}
-
 			return true;
 		},
 
@@ -163,7 +162,6 @@
 				slide.get_field("fy_start_date").set_value(current_year + '-' + fy[0]);
 				slide.get_field("fy_end_date").set_value(next_year + '-' + fy[1]);
 			}
-
 		},
 
 
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 8a47df6..721f216 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -129,7 +129,7 @@
 
 	make_subscription: function(doctype, docname) {
 		frappe.call({
-			method: "erpnext.subscription.doctype.subscription.subscription.make_subscription",
+			method: "erpnext.accounts.doctype.subscription.subscription.make_subscription",
 			args: {
 				doctype: doctype,
 				docname: docname
diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less
index de46c53..d0c4841 100644
--- a/erpnext/public/less/erpnext.less
+++ b/erpnext/public/less/erpnext.less
@@ -423,4 +423,19 @@
 	padding: 5px 9px;
 	border-radius: 3px;
 	color: #fff;
+
+}
+
+// Leaderboard
+
+.leaderboard {
+	.result {
+		border-top: 1px solid #d1d8dd;
+	}
+	.list-item {
+		padding-left: 45px;
+	}
+	.list-item_content {
+		padding-right: 45px;
+	}
 }
\ No newline at end of file
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 466c778..106a3d5 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 
 import frappe, os, json
-from frappe.custom.doctype.custom_field.custom_field import create_custom_field
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
 from frappe.permissions import add_permission
 from erpnext.regional.india import states
 
@@ -148,15 +148,7 @@
 		'Purchase Invoice Item': [hsn_sac_field]
 	}
 
-	for doctype, fields in custom_fields.items():
-		for df in fields:
-			field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": df["fieldname"]})
-			if not field:
-				create_custom_field(doctype, df)
-			else:
-				custom_field = frappe.get_doc("Custom Field", field)
-				custom_field.update(df)
-				custom_field.save()
+	create_custom_fields(custom_fields)
 
 def make_fixtures():
 	docs = [
diff --git a/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py b/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py
index 1a54cc3..b0dfdcb 100644
--- a/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py
+++ b/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py
@@ -14,7 +14,8 @@
 		dict(fieldtype='Data', label='Export Type', width=120),
 		dict(fieldtype='Data', label='E-Commerce GSTIN', width=130),
 		dict(fieldtype='Data', label='HSN Code', width=120),
-		dict(fieldtype='Data', label='Supplier Invoice No', width=120)
+		dict(fieldtype='Data', label='Supplier Invoice No', width=120),
+		dict(fieldtype='Date', label='Supplier Invoice Date', width=100)
 	], additional_query_columns=[
 		'supplier_gstin',
 		'company_gstin',
@@ -23,5 +24,6 @@
 		'export_type',
 		'ecommerce_gstin',
 		'gst_hsn_code',
-		'bill_no'
+		'bill_no',
+		'bill_date'
 	])
diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py
index ff2da07..ea4da69 100644
--- a/erpnext/schools/api.py
+++ b/erpnext/schools/api.py
@@ -18,6 +18,7 @@
 			(program), as_dict=1)
 	return courses
 
+
 @frappe.whitelist()
 def enroll_student(source_name):
 	"""Creates a Student Record and returns a Program Enrollment.
@@ -40,6 +41,7 @@
 	frappe.publish_realtime('enroll_student_progress', {"progress": [4, 4]}, user=frappe.session.user)	
 	return program_enrollment
 
+
 @frappe.whitelist()
 def check_attendance_records_exist(course_schedule=None, student_group=None, date=None):
 	"""Check if Attendance Records are made against the specified Course Schedule or Student Group for given date.
@@ -53,6 +55,7 @@
 	else:
 		return frappe.get_list("Student Attendance", filters={"student_group": student_group, "date": date})
 
+
 @frappe.whitelist()
 def mark_attendance(students_present, students_absent, course_schedule=None, student_group=None, date=None):
 	"""Creates Multiple Attendance Records.
@@ -76,6 +79,7 @@
 	frappe.db.commit()
 	frappe.msgprint(_("Attendance has been marked successfully."))
 
+
 def make_attendance_records(student, student_name, status, course_schedule=None, student_group=None, date=None):
 	"""Creates/Update Attendance Record.
 
@@ -103,6 +107,7 @@
 	student_attendance.status = status
 	student_attendance.save()
 
+
 @frappe.whitelist()
 def get_student_guardians(student):
 	"""Returns List of Guardians of a Student.
@@ -113,6 +118,7 @@
 		filters={"parent": student})
 	return guardians
 
+
 @frappe.whitelist()
 def get_student_group_students(student_group, include_inactive=0):
 	"""Returns List of student, student_name in Student Group.
@@ -127,6 +133,7 @@
 			filters={"parent": student_group, "active": 1}, order_by= "group_roll_number")
 	return students
 
+
 @frappe.whitelist()
 def get_fee_structure(program, academic_term=None):
 	"""Returns Fee Structure.
@@ -138,6 +145,7 @@
 		"academic_term": academic_term}, 'name', as_dict=True)
 	return fee_structure[0].name if fee_structure else None
 
+
 @frappe.whitelist()
 def get_fee_components(fee_structure):
 	"""Returns Fee Components.
@@ -148,6 +156,7 @@
 		fs = frappe.get_list("Fee Component", fields=["fees_category", "amount"] , filters={"parent": fee_structure}, order_by= "idx")
 		return fs
 
+
 @frappe.whitelist()
 def get_fee_schedule(program, student_category=None):
 	"""Returns Fee Schedule.
@@ -159,6 +168,7 @@
 		filters={"parent": program, "student_category": student_category }, order_by= "idx")
 	return fs
 
+
 @frappe.whitelist()
 def collect_fees(fees, amt):
 	paid_amount = flt(amt) + flt(frappe.db.get_value("Fees", fees, "paid_amount"))
@@ -167,6 +177,7 @@
 	frappe.db.set_value("Fees", fees, "outstanding_amount", (total_amount - paid_amount))
 	return paid_amount
 
+
 @frappe.whitelist()
 def get_course_schedule_events(start, end, filters=None):
 	"""Returns events for Course Schedule Calendar view rendering.
@@ -191,6 +202,7 @@
 
 	return data
 
+
 @frappe.whitelist()
 def get_assessment_criteria(course):
 	"""Returns Assessmemt Criteria and their Weightage from Course Master.
@@ -200,22 +212,30 @@
 	return frappe.get_list("Course Assessment Criteria", \
 		fields=["assessment_criteria", "weightage"], filters={"parent": course}, order_by= "idx")
 
+
 @frappe.whitelist()
 def get_assessment_students(assessment_plan, student_group):
-	
 	student_list = get_student_group_students(student_group)
 	for i, student in enumerate(student_list):
 		result = get_result(student.student, assessment_plan)
 		if result:
 			student_result = {}
 			for d in result.details:
-				student_result.update({d.assessment_criteria: cstr(d.score) + " ("+ d.grade + ")"})
-			student_result.update({"total_score": cstr(result.total_score) + " (" + result.grade + ")"})
-			student.update({'assessment_details': student_result})
+				student_result.update({d.assessment_criteria: [cstr(d.score), d.grade]})
+			student_result.update({
+				"total_score": [cstr(result.total_score), result.grade],
+				"comment": result.comment
+			})
+			student.update({
+				"assessment_details": student_result,
+				"docstatus": result.docstatus,
+				"name": result.name
+			})
 		else:
 			student.update({'assessment_details': None})
 	return student_list
 
+
 @frappe.whitelist()
 def get_assessment_details(assessment_plan):
 	"""Returns Assessment Criteria  and Maximum Score from Assessment Plan Master.
@@ -223,7 +243,8 @@
 	:param Assessment Plan: Assessment Plan
 	"""
 	return frappe.get_list("Assessment Plan Criteria", \
-		fields=["assessment_criteria", "maximum_score"], filters={"parent": assessment_plan}, order_by= "idx")
+		fields=["assessment_criteria", "maximum_score", "docstatus"], filters={"parent": assessment_plan}, order_by= "idx")
+
 
 @frappe.whitelist()
 def get_result(student, assessment_plan):
@@ -232,12 +253,14 @@
 	:param Student: Student
 	:param Assessment Plan: Assessment Plan
 	"""
-	results = frappe.get_all("Assessment Result", filters={"student": student, "assessment_plan": assessment_plan, "docstatus": 1})
+	results = frappe.get_all("Assessment Result", filters={"student": student,
+		"assessment_plan": assessment_plan, "docstatus": ("!=", 2)})
 	if results:
 		return frappe.get_doc("Assessment Result", results[0])
 	else:
 		return None
 
+
 @frappe.whitelist()
 def get_grade(grading_scale, percentage):
 	"""Returns Grade based on the Grading Scale and Score.
@@ -257,25 +280,63 @@
 			grade = ""
 	return grade
 
+
 @frappe.whitelist()
-def mark_assessment_result(student, assessment_plan, scores):
-	student_score = json.loads(scores)
-	details = []
-	for s in student_score.keys():
-		details.append({
-			"assessment_criteria": s,
-			"score": flt(student_score[s])
+def mark_assessment_result(assessment_plan, scores):
+	student_score = json.loads(scores);
+	assessment_details = []
+	for criteria in student_score.get("assessment_details"):
+		assessment_details.append({
+			"assessment_criteria": criteria,
+			"score": flt(student_score["assessment_details"][criteria])
 		})
-	assessment_result = frappe.new_doc("Assessment Result")
+	assessment_result = get_assessment_result_doc(student_score["student"], assessment_plan)
 	assessment_result.update({
-		"student": student,
-		"student_name": frappe.db.get_value("Student", student, "title"),
+		"student": student_score.get("student"),
 		"assessment_plan": assessment_plan,
-		"details": details
+		"comment": student_score.get("comment"),
+		"total_score":student_score.get("total_score"),
+		"details": assessment_details
 	})
 	assessment_result.save()
-	assessment_result.submit()	
-	return assessment_result
+	details = {}
+	for d in assessment_result.details:
+		details.update({d.assessment_criteria: d.grade})
+	assessment_result_dict = {
+		"name": assessment_result.name,
+		"student": assessment_result.student,
+		"total_score": assessment_result.total_score,
+		"grade": assessment_result.grade,
+		"details": details
+	}
+	return assessment_result_dict
+
+
+@frappe.whitelist()
+def submit_assessment_results(assessment_plan, student_group):
+	total_result = 0
+	student_list = get_student_group_students(student_group)
+	for i, student in enumerate(student_list):
+		doc = get_result(student.student, assessment_plan)
+		if doc and doc.docstatus==0:
+			total_result += 1
+			doc.submit()
+	return total_result
+
+
+def get_assessment_result_doc(student, assessment_plan):
+	assessment_result = frappe.get_all("Assessment Result", filters={"student": student,
+			"assessment_plan": assessment_plan, "docstatus": ("!=", 2)})
+	if assessment_result:
+		doc = frappe.get_doc("Assessment Result", assessment_result[0])
+		if doc.docstatus == 0:
+			return doc
+		elif doc.docstatus == 1:
+			frappe.msgprint("Result already Submitted")
+			return None
+	else:
+		return frappe.new_doc("Assessment Result")
+
 
 @frappe.whitelist()
 def update_email_group(doctype, name):
@@ -293,3 +354,21 @@
 			if email:
 				email_list.append(email)	
 	add_subscribers(name, email_list)
+
+@frappe.whitelist()
+def get_current_enrollment(student, academic_year=None):
+	current_academic_year = academic_year or frappe.defaults.get_defaults().academic_year
+	program_enrollment_list = frappe.db.sql('''
+		select
+			name as program_enrollment, student_name, program, student_batch_name as student_batch,
+			student_category, academic_term, academic_year
+		from 
+			`tabProgram Enrollment`
+		where 
+			student = %s and academic_year = %s
+		order by creation''', (student, current_academic_year), as_dict=1)
+
+	if program_enrollment_list:
+		return program_enrollment_list[0]
+	else:
+		return None
diff --git a/erpnext/schools/doctype/academic_term/test_records.json b/erpnext/schools/doctype/academic_term/test_records.json
index 2d84383..6bd3655 100644
--- a/erpnext/schools/doctype/academic_term/test_records.json
+++ b/erpnext/schools/doctype/academic_term/test_records.json
@@ -13,5 +13,15 @@
         "doctype": "Academic Term",
         "academic_year": "2014-2015",
         "term_name": "_Test Academic Term 2"
+    },
+    {
+        "doctype": "Academic Term",
+        "academic_year": "2017-2018",
+        "term_name": "_Test AT1"
+    },
+    {
+        "doctype": "Academic Term",
+        "academic_year": "2017-2018",
+        "term_name": "_Test AT2"
     }
 ]    
\ No newline at end of file
diff --git a/erpnext/schools/doctype/academic_year/test_records.json b/erpnext/schools/doctype/academic_year/test_records.json
index dba4f12..5eb5e2e 100644
--- a/erpnext/schools/doctype/academic_year/test_records.json
+++ b/erpnext/schools/doctype/academic_year/test_records.json
@@ -1,11 +1,18 @@
 [
 	{
+        "doctype": "Academic Year",
 		"academic_year_name": "2014-2015"
 	},
 	{
+        "doctype": "Academic Year",
 		"academic_year_name": "2015-2016"
 	},
 	{
+        "doctype": "Academic Year",
 		"academic_year_name": "2016-2017"
+	},
+	{
+        "doctype": "Academic Year",
+		"academic_year_name": "2017-2018"
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.json b/erpnext/schools/doctype/assessment_result/assessment_result.json
index c6b3c44..13b927c 100644
--- a/erpnext/schools/doctype/assessment_result/assessment_result.json
+++ b/erpnext/schools/doctype/assessment_result/assessment_result.json
@@ -410,7 +410,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "fieldname": "comment", 
-   "fieldtype": "Long Text", 
+   "fieldtype": "Small Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -474,7 +474,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-06-30 08:21:46.875594", 
+ "modified": "2017-08-31 15:39:24.813328", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Assessment Result", 
diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.py b/erpnext/schools/doctype/assessment_result/assessment_result.py
index c878ec3..3c036dd 100644
--- a/erpnext/schools/doctype/assessment_result/assessment_result.py
+++ b/erpnext/schools/doctype/assessment_result/assessment_result.py
@@ -9,13 +9,18 @@
 from frappe.model.document import Document
 from erpnext.schools.api import get_grade
 from erpnext.schools.api import get_assessment_details
+from frappe.utils.csvutils import getlink
+
 
 class AssessmentResult(Document):
 	def validate(self):
+		if self.student and not self.student_name:
+			self.student_name = frappe.db.get_value("Student", self.student, "title")
 		self.grading_scale = frappe.db.get_value("Assessment Plan", self.assessment_plan, "grading_scale")
 		self.validate_maximum_score()
 		self.validate_grade()
-	
+		self.validate_duplicate()
+
 	def validate_maximum_score(self):
 		self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score")
 		assessment_details = get_assessment_details(self.assessment_plan)
@@ -34,3 +39,13 @@
 			d.grade = get_grade(self.grading_scale, (flt(d.score)/d.maximum_score)*100)
 			self.total_score += d.score
 		self.grade = get_grade(self.grading_scale, (self.total_score/self.maximum_score)*100)
+
+	def validate_duplicate(self):
+		assessment_result = frappe.get_list("Assessment Result", filters={"name": ("not in", [self.name]),
+			"student":self.student, "assessment_plan":self.assessment_plan, "docstatus":("!=", 2)})
+		if assessment_result:
+			frappe.throw(_("Assessment Result record {0} already exists.".format(getlink("Assessment Result",assessment_result[0].name))))
+
+
+
+
diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js
index a2eecef..dfa7b14 100644
--- a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js
+++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js
@@ -1,12 +1,13 @@
-
 // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
 // For license information, please see license.txt
 
-cur_frm.add_fetch("assessment_plan", "student_group", "student_group");
 
 frappe.ui.form.on('Assessment Result Tool', {
+	setup: function(frm) {
+		frm.add_fetch("assessment_plan", "student_group", "student_group");
+	},
+
 	refresh: function(frm) {
-		frm.trigger("assessment_plan");
 		if (frappe.route_options) {
 			frm.set_value("student_group", frappe.route_options.student_group);
 			frm.set_value("assessment_plan", frappe.route_options.assessment_plan);
@@ -14,98 +15,145 @@
 		}
 		frm.disable_save();
 		frm.page.clear_indicator();
+		frm.trigger("assessment_plan");
 	},
 
 	assessment_plan: function(frm) {
-		if(!frm.doc.student_group) return;
-		frappe.call({
-			method: "erpnext.schools.api.get_assessment_students",
-			args: {
-				"assessment_plan": frm.doc.assessment_plan,
-				"student_group": frm.doc.student_group
-			},
-			callback: function(r) {
-				frm.events.render_table(frm, r.message);
-			}
-		});
+		frm.doc.show_submit = false;
+		if(frm.doc.assessment_plan) {
+			if (!frm.doc.student_group)
+				return
+			frappe.call({
+				method: "erpnext.schools.api.get_assessment_students",
+				args: {
+					"assessment_plan": frm.doc.assessment_plan,
+					"student_group": frm.doc.student_group
+				},
+				callback: function(r) {
+					frm.doc.students = r.message;
+					frm.events.render_table(frm);
+					for (let value of r.message) {
+						if (!value.docstatus) {
+							frm.doc.show_submit = true;
+							break;
+						}
+					}
+					frm.events.submit_result(frm);
+				}
+			});
+		}
 	},
 
-	render_table: function(frm, students) {
+	render_table: function(frm) {
 		$(frm.fields_dict.result_html.wrapper).empty();
-		var assessment_plan = frm.doc.assessment_plan;
-		var student_scores = {};
-		students.forEach(function(stu) {
-			student_scores[stu.student] = {}
-		});
-		
+		let assessment_plan = frm.doc.assessment_plan;
 		frappe.call({
 			method: "erpnext.schools.api.get_assessment_details",
 			args: {
 				assessment_plan: assessment_plan
 			},
 			callback: function(r) {
-				var criteria_list = r.message;
-				var max_total_score = 0;
-				criteria_list.forEach(function(c) {
-					max_total_score += c.maximum_score
-				});
-				var result_table = $(frappe.render_template('assessment_result_tool', {
-					frm: frm,
-					students: students,
-					criteria: criteria_list,
-					max_total_score: max_total_score
-				}));
-				result_table.appendTo(frm.fields_dict.result_html.wrapper)
-
-				result_table.on('change', 'input', function(e) {
-					var $input = $(e.target);
-					var max_score = $input.data().maxScore;
-					var student = $input.data().student;
-					var criteria = $input.data().criteria;
-					var value = $input.val();
-					if(value < 0) {
-						$input.val(0);
-						value = 0;
-					}
-					if(value > max_score) {
-						$input.val(max_score);
-						value = max_score;
-					}
-					student_scores[student][criteria] = value;
-					if(Object.keys(student_scores[student]).length == criteria_list.length) {
-						console.log("ok");
-						frappe.call(({
-							method: "erpnext.schools.api.mark_assessment_result",
-							args: {
-								"student": student,
-								"assessment_plan": assessment_plan,
-								"scores": student_scores[student]
-							},
-							callback: function(r) {
-								var doc = r.message;
-								var student = doc.student;
-								result_table.find(`[data-student=${student}].total-score`)
-									.html(doc.total_score + ' ('+ doc.grade + ')');
-								var details = doc.details;
-								result_table.find(`tr[data-student=${student}]`).addClass('text-muted');
-								result_table.find(`input[data-student=${student}]`).each(function(el, input) {
-									var $input = $(input);
-									var criteria = $input.data().criteria;
-									var value = $input.val();
-									var grade = details.find(function(d) {
-										return d.assessment_criteria === criteria;
-									}).grade;
-									$input.val(`${value} (${grade})`);
-									$input.attr('disabled', true);
-								});
-
-							}
-						}))
-					}
-				});
-
+				frm.events.get_marks(frm, r.message);
 			}
 		});
 	},
 
+	get_marks: function(frm, criteria_list) {
+		let max_total_score = 0;
+		criteria_list.forEach(function(c) {
+			max_total_score += c.maximum_score
+		});
+		var result_table = $(frappe.render_template('assessment_result_tool', {
+			frm: frm,
+			students: frm.doc.students,
+			criteria: criteria_list,
+			max_total_score: max_total_score
+		}));
+		result_table.appendTo(frm.fields_dict.result_html.wrapper);
+
+		result_table.on('change', 'input', function(e) {
+			let $input = $(e.target);
+			let student = $input.data().student;
+			let max_score = $input.data().maxScore;
+			let value = $input.val();
+			if(value < 0) {
+				$input.val(0);
+			} else if(value > max_score) {
+				$input.val(max_score);
+			}
+			let total_score = 0;
+			let student_scores = {};
+			student_scores["assessment_details"] = {}
+			result_table.find(`input[data-student=${student}].student-result-data`)
+				.each(function(el, input) {
+					let $input = $(input);
+					let criteria = $input.data().criteria;
+					let value = parseFloat($input.val());
+					if (value) {
+						student_scores["assessment_details"][criteria] = value;
+					}
+					total_score += value;
+			});
+			if(!Number.isNaN(total_score)) {
+				result_table.find(`span[data-student=${student}].total-score`).html(total_score);
+			}
+			if (Object.keys(student_scores["assessment_details"]).length === criteria_list.length) {
+				student_scores["student"] = student;
+				student_scores["total_score"] = total_score;
+				result_table.find(`[data-student=${student}].result-comment`)
+					.each(function(el, input){
+					student_scores["comment"] = $(input).val();
+				});
+				frappe.call({
+					method: "erpnext.schools.api.mark_assessment_result",
+					args: {
+						"assessment_plan": frm.doc.assessment_plan,
+						"scores": student_scores
+					},
+					callback: function(r) {
+						let assessment_result = r.message;
+						if (!frm.doc.show_submit) {
+							frm.doc.show_submit = true;
+							frm.events.submit_result;
+						}
+						for (var criteria of Object.keys(assessment_result.details)) {
+							result_table.find(`[data-criteria=${criteria}][data-student=${assessment_result
+								.student}].student-result-grade`).each(function(e1, input) {
+									$(input).html(assessment_result.details[criteria]);
+							});
+						}
+						result_table.find(`span[data-student=${assessment_result.student}].total-score-grade`).html(assessment_result.grade);
+						let link_span = result_table.find(`span[data-student=${assessment_result.student}].total-result-link`);
+						$(link_span).css("display", "block");
+						$(link_span).find("a").attr("href", "#Form/Assessment Result/"+assessment_result.name);
+					}
+				});
+			}
+		});
+	},
+
+	submit_result: function(frm) {
+		if (frm.doc.show_submit) {
+			frm.page.set_primary_action(__("Submit"), function() {
+				frappe.call({
+					method: "erpnext.schools.api.submit_assessment_results",
+					args: {
+						"assessment_plan": frm.doc.assessment_plan,
+						"student_group": frm.doc.student_group
+					},
+					callback: function(r) {
+						if (r.message) {
+							frappe.msgprint(__("{0} Result submittted", [r.message]));
+						} else {
+							frappe.msgprint(__("No Result to submit"));
+						}
+						frm.events.assessment_plan(frm);
+					}
+				});
+			});
+		}
+		else {
+			frm.page.clear_primary_action();
+		}
+	}
 });
diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py
index a0d286c..649f420 100644
--- a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py
+++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.py
@@ -7,4 +7,4 @@
 from frappe.model.document import Document
 
 class AssessmentResultTool(Document):
-	pass
+	pass
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_category/test_records.json b/erpnext/schools/doctype/fee_category/test_records.json
new file mode 100644
index 0000000..598c1ed
--- /dev/null
+++ b/erpnext/schools/doctype/fee_category/test_records.json
@@ -0,0 +1,11 @@
+[
+	{
+		"category_name": "Admission Fee"
+	},
+	{
+		"category_name": "Tuition Fee"
+	},
+	{
+		"category_name": "Transportation Fee"
+	}
+]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_component/fee_component.json b/erpnext/schools/doctype/fee_component/fee_component.json
index 2b4e002..ccf1f65 100644
--- a/erpnext/schools/doctype/fee_component/fee_component.json
+++ b/erpnext/schools/doctype/fee_component/fee_component.json
@@ -51,6 +51,36 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -120,7 +150,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-06-30 08:21:47.947269", 
+ "modified": "2017-09-11 16:48:07.810959", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fee Component", 
diff --git a/erpnext/subscription/doctype/__init__.py b/erpnext/schools/doctype/fee_schedule/__init__.py
similarity index 100%
copy from erpnext/subscription/doctype/__init__.py
copy to erpnext/schools/doctype/fee_schedule/__init__.py
diff --git a/erpnext/schools/doctype/fee_schedule/fee_schedule.js b/erpnext/schools/doctype/fee_schedule/fee_schedule.js
new file mode 100644
index 0000000..d834b88
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule/fee_schedule.js
@@ -0,0 +1,113 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Fee Schedule', {
+	setup: function(frm) {
+		frm.add_fetch("fee_structure", "receivable_account", "receivable_account");
+		frm.add_fetch("fee_structure", "income_account", "income_account");
+		frm.add_fetch("fee_structure", "cost_center", "cost_center");
+	},
+
+	onload: function(frm) {
+		frm.set_query("receivable_account", function(doc) {
+			return {
+				filters: {
+					'account_type': 'Receivable',
+					'is_group': 0,
+					'company': doc.company
+				}
+			};
+		});
+		frm.set_query("income_account", function(doc) {
+			return {
+				filters: {
+					'account_type': 'Income Account',
+					'is_group': 0,
+					'company': doc.company
+				}
+			};
+		});
+		frm.set_query("student_group", "student_groups", function() {
+			return {
+				"program": frm.doc.program,
+				"academic_year": frm.doc.academic_year
+			};
+		});
+		frappe.realtime.on("fee_schedule_progress", function(data) {
+			if (data.reload && data.reload === 1) {
+				frm.reload_doc();
+			}
+			if (data.progress && data.progress === "0") {
+				frappe.msgprint(__("Fee records will be created in the background. In case of any error the error message will be updated in the Schedule."));
+			}
+			if (data.progress) {
+				let progress_bar = $(cur_frm.dashboard.progress_area).find(".progress-bar");
+				if (progress_bar) {
+					$(progress_bar).removeClass("progress-bar-danger").addClass("progress-bar-success progress-bar-striped");
+					$(progress_bar).css("width", data.progress+"%");
+				}
+			}
+		});
+	},
+
+	refresh: function(frm) {
+		if(!frm.doc.__islocal && frm.doc.__onload && frm.doc.__onload.dashboard_info &&
+			frm.doc.fee_creation_status=="Successful") {
+			var info = frm.doc.__onload.dashboard_info;
+			frm.dashboard.add_indicator(__('Total Collected: {0}', [format_currency(info.total_paid,
+				info.currency)]), 'blue');
+			frm.dashboard.add_indicator(__('Total Outstanding: {0}', [format_currency(info.total_unpaid,
+				info.currency)]), info.total_unpaid ? 'orange' : 'green');
+		}
+		if (frm.doc.fee_creation_status=="In Process") {
+			frm.dashboard.add_progress("Fee Creation Status", "0");
+		}
+		if (frm.doc.docstatus==1 && !frm.doc.fee_creation_status || frm.doc.fee_creation_status == "Failed") {
+			frm.add_custom_button(__('Create Fees'), function() {
+				frappe.call({
+					method: "create_fees",
+					doc: frm.doc,
+					callback: function() {
+						frm.refresh();
+					}
+				});
+			}, "fa fa-play", "btn-success");
+		}
+	},
+
+	fee_structure: function(frm) {
+		if (frm.doc.fee_structure) {
+			frappe.call({
+				method: "erpnext.schools.doctype.fee_schedule.fee_schedule.get_fee_structure",
+				args: {
+					"target_doc": frm.doc.name,
+					"source_name": frm.doc.fee_structure
+				},
+				callback: function(r) {
+					var doc = frappe.model.sync(r.message);
+					frappe.set_route("Form", doc[0].doctype, doc[0].name);
+				}
+			});
+		}
+	}
+});
+
+frappe.ui.form.on("Fee Schedule Student Group", {
+	student_group: function(frm, cdt, cdn) {
+		var row = locals[cdt][cdn];
+		frappe.call({
+			method: "erpnext.schools.doctype.fee_schedule.fee_schedule.get_total_students",
+			args: {
+				"student_group": row.student_group,
+				"academic_year": frm.doc.academic_year,
+				"academic_term": frm.doc.academic_term,
+				"student_category": frm.doc.student_category
+			},
+			callback: function(r) {
+				if(!r.exc) {
+					frappe.model.set_value(cdt, cdn, "total_students", r.message);
+				}
+			}
+		});
+	}
+})
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_schedule/fee_schedule.json b/erpnext/schools/doctype/fee_schedule/fee_schedule.json
new file mode 100644
index 0000000..d2b5c52
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule/fee_schedule.json
@@ -0,0 +1,1069 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "autoname": "naming_series:", 
+ "beta": 1, 
+ "creation": "2017-07-18 15:21:21.527136", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "editable_grid": 0, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "fee_structure", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Fee Structure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Fee Structure", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "due_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Due Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Naming Series", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "FRQ.", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "fee_creation_status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Fee Creation Status", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "\nIn Process\nFailed\nSuccessful", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "send_email", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Send Payment Request Email", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_4", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_category", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Category", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Category", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "program", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Program", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Program", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "academic_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Academic Year", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Academic Year", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "academic_term", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Academic Term", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Academic Term", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_10", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "student_groups", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Fee Schedule Student Group", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_14", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Fee Breakup for each student", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "components", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Fee Component", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_16", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_18", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "total_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Total Amount per Student", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "grand_total", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Grand Total", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "grand_total_in_words", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "In Words", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "edit_printing_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Printing Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Letter Head", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_32", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Print Heading", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "account", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Accounting", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "receivable_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Receivable Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "income_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_39", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Cost Center", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Institution", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Fee Schedule", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "", 
+   "columns": 0, 
+   "depends_on": "error_log", 
+   "fieldname": "section_break_31", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Error Log", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "error_log", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Error Log", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2017-09-19 16:24:17.266071", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Fee Schedule", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Academics User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "", 
+ "track_changes": 0, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_schedule/fee_schedule.py b/erpnext/schools/doctype/fee_schedule/fee_schedule.py
new file mode 100644
index 0000000..fc2907a
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule/fee_schedule.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe, erpnext
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import money_in_words
+from frappe.utils import cint, flt, cstr
+from frappe.utils.background_jobs import enqueue
+
+
+class FeeSchedule(Document):
+	def onload(self):
+		info = self.get_dashboard_info()
+		self.set_onload('dashboard_info', info)
+
+	def get_dashboard_info(self):
+		info = {
+			"total_paid": 0,
+			"total_unpaid": 0,
+			"currency": erpnext.get_company_currency(self.company)
+		}
+
+		fees_amount = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount) from tabFees
+			where fee_schedule=%s and docstatus=1""", (self.name))
+
+		if fees_amount:
+			info["total_paid"] = flt(fees_amount[0][0]) - flt(fees_amount[0][1])
+			info["total_unpaid"] = flt(fees_amount[0][1])
+
+		return info
+
+	def validate(self):
+		self.calculate_total()
+
+	def calculate_total(self):
+		no_of_students = 0
+		for d in self.student_groups:
+			# if not d.total_students:
+			d.total_students = get_total_students(d.student_group, self.academic_year,
+				self.academic_term, self.student_category)
+			no_of_students += cint(d.total_students)
+		self.grand_total = no_of_students*self.total_amount
+		self.grand_total_in_words = money_in_words(self.grand_total)
+
+	def create_fees(self):
+		self.db_set("fee_creation_status", "In Process")
+		frappe.publish_realtime("fee_schedule_progress",
+			{"progress": "0", "reload": 1}, user=frappe.session.user)
+		enqueue(generate_fee, queue='default', timeout=6000, event='generate_fee',
+			fee_schedule=self.name)
+
+def generate_fee(fee_schedule):
+	doc = frappe.get_doc("Fee Schedule", fee_schedule)
+	error = False
+	total_records = sum([int(d.total_students) for d in doc.student_groups])
+	created_records = 0
+	for d in doc.student_groups:
+		students = frappe.db.sql(""" select sg.program, sg.batch, sgs.student, sgs.student_name
+			from `tabStudent Group` sg, `tabStudent Group Student` sgs
+			where sg.name=%s and sg.name=sgs.parent and sgs.active=1""", d.student_group, as_dict=1)
+
+		for student in students:
+			try:
+				fees_doc = get_mapped_doc("Fee Schedule", fee_schedule,	{
+					"Fee Schedule": {
+						"doctype": "Fees",
+						"field_map": {
+							"name": "Fee Schedule"
+						}
+					}
+				})
+				fees_doc.student = student.student
+				fees_doc.student_name = student.student_name
+				fees_doc.program = student.program
+				fees_doc.student_batch = student.batch
+				fees_doc.send_payment_request = doc.send_email
+				fees_doc.save()
+				fees_doc.submit()
+				created_records += 1
+				frappe.publish_realtime("fee_schedule_progress", {"progress": str(int(created_records * 100/total_records))}, user=frappe.session.user)
+
+			except Exception as e:
+				error = True
+				err_msg = frappe.local.message_log and "\n\n".join(frappe.local.message_log) or cstr(e)
+
+	if error:
+		frappe.db.rollback()
+		frappe.db.set_value("Fee Schedule", fee_schedule, "fee_creation_status", "Failed")
+		frappe.db.set_value("Fee Schedule", fee_schedule, "error_log", err_msg)
+
+	else:
+		frappe.db.set_value("Fee Schedule", fee_schedule, "fee_creation_status", "Successful")
+		frappe.db.set_value("Fee Schedule", fee_schedule, "error_log", None)
+
+	frappe.publish_realtime("fee_schedule_progress",
+		{"progress": "100", "reload": 1}, user=frappe.session.user)
+
+
+@frappe.whitelist()
+def get_fee_structure(source_name,target_doc=None):
+	fee_request = get_mapped_doc("Fee Structure", source_name,
+		{"Fee Structure": {
+			"doctype": "Fee Schedule"
+		}}, ignore_permissions=True)
+	return fee_request
+
+@frappe.whitelist()
+def get_total_students(student_group, academic_year, academic_term=None, student_category=None):
+	conditions = ""
+	if student_category:
+		conditions = " and pe.student_category='{}'".format(frappe.db.escape(student_category))
+	if academic_term:
+		conditions = " and pe.academic_term='{}'".format(frappe.db.escape(academic_term))
+
+
+	return frappe.db.sql("""
+		select count(pe.name)
+		from `tabStudent Group Student` sgs, `tabProgram Enrollment` pe
+		where 
+			pe.student = sgs.student
+			and pe.academic_year = %s
+			and sgs.parent = %s
+			and sgs.active = 1
+			{conditions}
+	""".format(conditions=conditions), (academic_year, student_group))[0][0]
diff --git a/erpnext/schools/doctype/fee_schedule/fee_schedule_list.js b/erpnext/schools/doctype/fee_schedule/fee_schedule_list.js
new file mode 100644
index 0000000..3039c51
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule/fee_schedule_list.js
@@ -0,0 +1,14 @@
+frappe.listview_settings['Fee Schedule'] = {
+	add_fields: ["fee_creation_status", "due_date", "grand_total"],
+	get_indicator: function(doc) {
+		if (doc.fee_creation_status=="Successful") {
+			return [__("Fee Created"), "blue", "fee_creation_status,=,Successful"];
+		} else if(doc.fee_creation_status == "In Process") {
+			return [__("Creating Fees"), "orange", "fee_creation_status,=,In Process"];
+		} else if(doc.fee_creation_status == "Failed") {
+			return [__("Fee Creation Failed"), "red", "fee_creation_status,=,Failed"];
+		} else {
+			return [__("Fee Creation Pending"), "green", "fee_creation_status,=,"];
+		}
+	}
+};
diff --git a/erpnext/schools/doctype/fee_schedule/test_fee_schedule.js b/erpnext/schools/doctype/fee_schedule/test_fee_schedule.js
new file mode 100644
index 0000000..d495b4c
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule/test_fee_schedule.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Fee Schedule", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially('Fee Schedule', [
+		// insert a new Fee Schedule
+		() => frappe.tests.make([
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/schools/doctype/fee_schedule/test_fee_schedule.py b/erpnext/schools/doctype/fee_schedule/test_fee_schedule.py
new file mode 100644
index 0000000..44e0756
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule/test_fee_schedule.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import unittest
+
+class TestFeeSchedule(unittest.TestCase):
+	pass
diff --git a/erpnext/subscription/__init__.py b/erpnext/schools/doctype/fee_schedule_program/__init__.py
similarity index 100%
copy from erpnext/subscription/__init__.py
copy to erpnext/schools/doctype/fee_schedule_program/__init__.py
diff --git a/erpnext/schools/doctype/fee_schedule_program/fee_schedule_program.json b/erpnext/schools/doctype/fee_schedule_program/fee_schedule_program.json
new file mode 100644
index 0000000..42cc7bf
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule_program/fee_schedule_program.json
@@ -0,0 +1,133 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2017-03-23 17:46:55.712169", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "program", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Program", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Program", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_batch", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Student Batch", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Batch Name", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "total_students", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Total Students", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-22 16:24:40.547517", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Fee Schedule Program", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_schedule_program/fee_schedule_program.py b/erpnext/schools/doctype/fee_schedule_program/fee_schedule_program.py
new file mode 100644
index 0000000..11d5697
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule_program/fee_schedule_program.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class FeeScheduleProgram(Document):
+	pass
diff --git a/erpnext/docs/assets/img/subscription/__init__.py b/erpnext/schools/doctype/fee_schedule_student_group/__init__.py
similarity index 100%
copy from erpnext/docs/assets/img/subscription/__init__.py
copy to erpnext/schools/doctype/fee_schedule_student_group/__init__.py
diff --git a/erpnext/schools/doctype/fee_schedule_student_group/fee_schedule_student_group.json b/erpnext/schools/doctype/fee_schedule_student_group/fee_schedule_student_group.json
new file mode 100644
index 0000000..c80e320
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule_student_group/fee_schedule_student_group.json
@@ -0,0 +1,102 @@
+{
+ "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2017-03-23 17:55:52.476822", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "editable_grid": 1, 
+ "engine": "InnoDB", 
+ "fields": [
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_group", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Student Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Group", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "total_students", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Total Students", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "has_web_view": 0, 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "image_view": 0, 
+ "in_create": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2017-08-22 16:23:12.337294", 
+ "modified_by": "Administrator", 
+ "module": "Schools", 
+ "name": "Fee Schedule Student Group", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "show_name_in_global_search": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_changes": 1, 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_schedule_student_group/fee_schedule_student_group.py b/erpnext/schools/doctype/fee_schedule_student_group/fee_schedule_student_group.py
new file mode 100644
index 0000000..776534d
--- /dev/null
+++ b/erpnext/schools/doctype/fee_schedule_student_group/fee_schedule_student_group.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+from frappe.model.document import Document
+
+class FeeScheduleStudentGroup(Document):
+	pass
diff --git a/erpnext/schools/doctype/fee_structure/fee_structure.js b/erpnext/schools/doctype/fee_structure/fee_structure.js
index fa46278..300bdc8 100644
--- a/erpnext/schools/doctype/fee_structure/fee_structure.js
+++ b/erpnext/schools/doctype/fee_structure/fee_structure.js
@@ -1,3 +1,50 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Fee Structure', {
+	setup: function(frm) {
+		frm.add_fetch("company", "default_receivable_account", "receivable_account");
+		frm.add_fetch("company", "default_income_account", "income_account");
+		frm.add_fetch("company", "cost_center", "cost_center");
+	},
+
+	onload: function(frm) {
+		frm.set_query("receivable_account", function(doc) {
+			return {
+				filters: {
+					'account_type': 'Receivable',
+					'is_group': 0,
+					'company': doc.company
+				}
+			};
+		});
+		frm.set_query("income_account", function(doc) {
+			return {
+				filters: {
+					'account_type': 'Income Account',
+					'is_group': 0,
+					'company': doc.company
+				}
+			};
+		});
+	},
+
+	refresh: function(frm) {
+		if(frm.doc.docstatus === 1) {
+			frm.add_custom_button(__("Make Fee Schedule"), function() {
+				frm.events.make_fee_schedule(frm);
+			});
+		}
+	},
+
+	make_fee_schedule: function(frm) {
+		frappe.model.open_mapped_doc({
+			method: "erpnext.schools.doctype.fee_structure.fee_structure.make_fee_schedule",
+			frm: frm
+		});
+	}
+});
+
 frappe.ui.form.on("Fee Component", {
 	amount: function(frm) {
 		var total_amount = 0;
diff --git a/erpnext/schools/doctype/fee_structure/fee_structure.json b/erpnext/schools/doctype/fee_structure/fee_structure.json
index 79d48cf..d93a667 100644
--- a/erpnext/schools/doctype/fee_structure/fee_structure.json
+++ b/erpnext/schools/doctype/fee_structure/fee_structure.json
@@ -19,39 +19,6 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "program", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 1, 
-   "in_list_view": 1, 
-   "in_standard_filter": 1, 
-   "label": "Program", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "earning_name", 
-   "oldfieldtype": "Data", 
-   "options": "Program", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -83,6 +50,70 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "student_category", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Category", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Category", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "program", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 1, 
+   "in_list_view": 1, 
+   "in_standard_filter": 1, 
+   "label": "Program", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "earning_name", 
+   "oldfieldtype": "Data", 
+   "options": "Program", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -146,7 +177,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "student_category", 
+   "fieldname": "academic_year", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -155,10 +186,10 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Student Category", 
+   "label": "Academic Year", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Student Category", 
+   "options": "Academic Year", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -266,6 +297,35 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "column_break_11", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -289,6 +349,220 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "accounts", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Accounts", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "fieldname": "receivable_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Receivable Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "income_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_16", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Cost Center", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Fee Structure", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 0, 
@@ -298,12 +572,12 @@
  "idx": 0, 
  "image_view": 0, 
  "in_create": 0, 
- "is_submittable": 0, 
+ "is_submittable": 1, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-06-30 08:21:48.057298", 
+ "modified": "2017-09-11 15:18:27.975666", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fee Structure", 
@@ -311,15 +585,15 @@
  "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0, 
+   "amend": 1, 
    "apply_user_permissions": 0, 
-   "cancel": 0, 
+   "cancel": 1, 
    "create": 1, 
    "delete": 1, 
    "email": 1, 
    "export": 1, 
    "if_owner": 0, 
-   "import": 0, 
+   "import": 1, 
    "permlevel": 0, 
    "print": 1, 
    "read": 1, 
@@ -327,7 +601,7 @@
    "role": "Academics User", 
    "set_user_permissions": 0, 
    "share": 1, 
-   "submit": 0, 
+   "submit": 1, 
    "write": 1
   }
  ], 
diff --git a/erpnext/schools/doctype/fee_structure/fee_structure.py b/erpnext/schools/doctype/fee_structure/fee_structure.py
index b71c507..781382b 100644
--- a/erpnext/schools/doctype/fee_structure/fee_structure.py
+++ b/erpnext/schools/doctype/fee_structure/fee_structure.py
@@ -5,6 +5,8 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+
 
 class FeeStructure(Document):
 	def validate(self):
@@ -16,3 +18,17 @@
 		for d in self.components:
 			self.total_amount += d.amount
 	
+
+@frappe.whitelist()
+def make_fee_schedule(source_name, target_doc=None):
+	return get_mapped_doc("Fee Structure", source_name,	{
+		"Fee Structure": {
+			"doctype": "Fee Schedule",
+			"validation": {
+				"docstatus": ["=", 1],
+			}
+		},
+		"Fee Component": {
+			"doctype": "Fee Component"
+		}
+	}, target_doc)
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_structure/test_fee_structure.js b/erpnext/schools/doctype/fee_structure/test_fee_structure.js
new file mode 100644
index 0000000..61f4135
--- /dev/null
+++ b/erpnext/schools/doctype/fee_structure/test_fee_structure.js
@@ -0,0 +1,23 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Fee Structure", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially([
+		// insert a new Fee Structure
+		() => frappe.tests.make('Fee Structure', [
+			// values to be set
+			{key: 'value'}
+		]),
+		() => {
+			assert.equal(cur_frm.doc.key, 'value');
+		},
+		() => done()
+	]);
+
+});
diff --git a/erpnext/schools/doctype/fee_structure/test_records.json b/erpnext/schools/doctype/fee_structure/test_records.json
new file mode 100644
index 0000000..8b7dc16
--- /dev/null
+++ b/erpnext/schools/doctype/fee_structure/test_records.json
@@ -0,0 +1,42 @@
+[
+	{
+		"doctype": "Fee Structure",
+		"academic_year": "2017-2018",
+		"academic_term": "2017-2018 (_Test AT1)",
+		"components": [
+			{
+				"fees_category": "Tuition Fee",
+				"amount": 40000
+			},
+			{
+				"fees_category": "Transportation Fee",
+				"amount": 10000
+			}
+		],
+		"total_amount": 50000,
+		"debit_to": "_Test Receivable - _TC",
+		"against_income_account": "Sales - _TC",
+		"cost_center": "_Test Cost Center - _TC",
+		"company": "_Test Company"
+	},
+	{
+		"doctype": "Fee Structure",
+		"academic_year": "2017-2018",
+		"academic_term": "2017-2018 (_Test AT2)",
+		"components": [
+			{
+				"fees_category": "Tuition Fee",
+				"amount": 40000
+			},
+			{
+				"fees_category": "Transportation Fee",
+				"amount": 10000
+			}
+		],
+		"total_amount": 50000,
+		"debit_to": "_Test Receivable - _TC",
+		"against_income_account": "Sales - _TC",
+		"cost_center": "_Test Cost Center - _TC",
+		"company": "_Test Company"
+	}
+]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fees/fees.js b/erpnext/schools/doctype/fees/fees.js
index e5a840a..4347308 100644
--- a/erpnext/schools/doctype/fees/fees.js
+++ b/erpnext/schools/doctype/fees/fees.js
@@ -1,65 +1,144 @@
+// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
 
-cur_frm.add_fetch("student", "title", "student_name");
 
 frappe.ui.form.on("Fees", {
+	setup: function(frm) {
+		frm.add_fetch("fee_structure", "receivable_account", "receivable_account");
+		frm.add_fetch("fee_structure", "income_account", "income_account");
+		frm.add_fetch("fee_structure", "cost_center", "cost_center");
+	},
 
 	onload: function(frm){
-		cur_frm.set_query("academic_term",function(){
+		frm.set_query("academic_term",function(){
 			return{
 				"filters":{
 					"academic_year": (frm.doc.academic_year)
 				}
 			};
 		});
-
-		cur_frm.set_query("fee_structure",function(){
+		frm.set_query("fee_structure",function(){
 			return{
 				"filters":{
-					"academic_term": (frm.doc.academic_term)
+					"academic_year": (frm.doc.academic_year)
 				}
 			};
 		});
-	},
-
-	refresh: function(frm) {
-		if (frm.doc.docstatus === 1 && (frm.doc.total_amount > frm.doc.paid_amount)) {
-			frm.add_custom_button(__("Collect Fees"), function() {
-				frappe.prompt({fieldtype:"Float", label: __("Amount Paid"), fieldname:"amt"},
-					function(data) {
-						frappe.call({
-							method:"erpnext.schools.api.collect_fees",
-							args: {
-								"fees": frm.doc.name,
-								"amt": data.amt
-							},
-							callback: function(r) {
-								frm.doc.paid_amount = r.message
-								frm.doc.outstanding_amount = frm.doc.total_amount - r.message
-								frm.refresh()
-							}
-						});
-					}, __("Enter Paid Amount"), __("Collect"));
-			});
+		frm.set_query("receivable_account", function(doc) {
+			return {
+				filters: {
+					'account_type': 'Receivable',
+					'is_group': 0,
+					'company': doc.company
+				}
+			};
+		});
+		frm.set_query("income_account", function(doc) {
+			return {
+				filters: {
+					'account_type': 'Income Account',
+					'is_group': 0,
+					'company': doc.company
+				}
+			};
+		});
+		if (!frm.doc.posting_date) {
+			frm.doc.posting_date = frappe.datetime.get_today();
 		}
 	},
 
-	program: function(frm) {
-		if (frm.doc.program && frm.doc.academic_term) {
+	refresh: function(frm) {
+		if(frm.doc.docstatus == 0 && frm.doc.set_posting_time) {
+			frm.set_df_property('posting_date', 'read_only', 0);
+			frm.set_df_property('posting_time', 'read_only', 0);
+		} else {
+			frm.set_df_property('posting_date', 'read_only', 1);
+			frm.set_df_property('posting_time', 'read_only', 1);
+		}
+		if(frm.doc.docstatus===1) {
+			frm.add_custom_button(__('Accounting Ledger'), function() {
+				frappe.route_options = {
+					voucher_no: frm.doc.name,
+					from_date: frm.doc.posting_date,
+					to_date: frm.doc.posting_date,
+					company: frm.doc.company,
+					group_by_voucher: false
+				};
+				frappe.set_route("query-report", "General Ledger");
+			}, __("View"));
+		}
+		if(frm.doc.docstatus===1 && frm.doc.outstanding_amount>0) {
+			frm.add_custom_button(__("Payment Request"), function() {
+				frm.events.make_payment_request(frm);
+			}, __("Make"));
+			frm.page.set_inner_btn_group_as_primary(__("Make"));
+		}
+		if(frm.doc.docstatus===1 && frm.doc.outstanding_amount!=0) {
+			frm.add_custom_button(__("Payment"), function() {
+				frm.events.make_payment_entry(frm);
+			}, __("Make"));
+			frm.page.set_inner_btn_group_as_primary(__("Make"));
+		}
+	},
+
+	student: function(frm) {
+		if (frm.doc.student) {
 			frappe.call({
-				method: "erpnext.schools.api.get_fee_structure",
+				method:"erpnext.schools.api.get_current_enrollment",
 				args: {
-					"program": frm.doc.program,
-					"academic_term": frm.doc.academic_term
+					"student": frm.doc.student,
+					"academic_year": frm.doc.academic_year
 				},
 				callback: function(r) {
-					if(r.message) {
-						frm.set_value("fee_structure" ,r.message);
+					if(r){
+						$.each(r.message, function(i, d) {
+							frm.set_value(i,d);
+						});
 					}
 				}
 			});
 		}
 	},
 
+	make_payment_request: function(frm) {
+		if (!frm.doc.student_email) {
+			frappe.msgprint(__("Please set the Email ID for the Student to send the Payment Request"));
+		} else {
+			frappe.call({
+				method:"erpnext.accounts.doctype.payment_request.payment_request.make_payment_request",
+				args: {
+					"dt": frm.doc.doctype,
+					"dn": frm.doc.name,
+					"recipient_id": frm.doc.student_email
+				},
+				callback: function(r) {
+					if(!r.exc){
+						var doc = frappe.model.sync(r.message);
+						frappe.set_route("Form", doc[0].doctype, doc[0].name);
+					}
+				}
+			});
+		}
+	},
+
+	make_payment_entry: function(frm) {
+		return frappe.call({
+			method: "erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry",
+			args: {
+				"dt": frm.doc.doctype,
+				"dn": frm.doc.name
+			},
+			callback: function(r) {
+				var doc = frappe.model.sync(r.message);
+				frappe.set_route("Form", doc[0].doctype, doc[0].name);
+			}
+		});
+	},
+
+	set_posting_time: function(frm) {
+		frm.refresh();
+	},
+
 	academic_term: function() {
 		frappe.ui.form.trigger("Fees", "program");
 	},
@@ -88,14 +167,15 @@
 	},
 
 	calculate_total_amount: function(frm) {
-		var total_amount = 0;
+		var grand_total = 0;
 		for(var i=0;i<frm.doc.components.length;i++) {
-			total_amount += frm.doc.components[i].amount;
+			grand_total += frm.doc.components[i].amount;
 		}
-		frm.set_value("total_amount", total_amount);
+		frm.set_value("grand_total", grand_total);
 	}
 });
 
+
 frappe.ui.form.on("Fee Component", {
 	amount: function(frm) {
 		frm.trigger("calculate_total_amount");
diff --git a/erpnext/schools/doctype/fees/fees.json b/erpnext/schools/doctype/fees/fees.json
index 67c06f7..7a2167b 100644
--- a/erpnext/schools/doctype/fees/fees.json
+++ b/erpnext/schools/doctype/fees/fees.json
@@ -4,7 +4,7 @@
  "allow_import": 0, 
  "allow_rename": 0, 
  "autoname": "naming_series:", 
- "beta": 0, 
+ "beta": 1, 
  "creation": "2015-09-22 16:57:22.143710", 
  "custom": 0, 
  "docstatus": 0, 
@@ -19,6 +19,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Naming Series", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "FEE.", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 1, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "student", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -50,7 +81,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "academic_year", 
+   "fieldname": "student_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "student.student_name", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "fee_schedule", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -59,10 +121,41 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Academic Year", 
+   "label": "Fee Schedule", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Academic Year", 
+   "options": "Fee Schedule", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "include_payment", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Include Payment", 
+   "length": 0, 
+   "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -81,8 +174,9 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "academic_term", 
-   "fieldtype": "Link", 
+   "default": "", 
+   "fieldname": "send_payment_request", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -90,74 +184,12 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Academic Term", 
+   "label": "Send Payment Request", 
    "length": 0, 
-   "no_copy": 0, 
-   "options": "Academic Term", 
+   "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "fee_structure", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Fee Structure", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Fee Structure", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "due_date", 
-   "fieldtype": "Date", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Due Date", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "remember_last_selected_value": 0, 
@@ -202,8 +234,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "student_name", 
-   "fieldtype": "Data", 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -211,14 +243,76 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Student Name", 
+   "label": "Institution", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "Today", 
+   "fieldname": "posting_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Date", 
+   "length": 0, 
+   "no_copy": 1, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "posting_time", 
+   "fieldtype": "Time", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Posting Time", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -232,8 +326,9 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "naming_series", 
-   "fieldtype": "Select", 
+   "depends_on": "eval:doc.docstatus==0", 
+   "fieldname": "set_posting_time", 
+   "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -241,20 +336,19 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Naming Series", 
+   "label": "Edit Posting Date and Time", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "FEE.", 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
-   "set_only_once": 1, 
+   "set_only_once": 0, 
    "unique": 0
   }, 
   {
@@ -263,19 +357,48 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "program", 
-   "fieldtype": "Link", 
+   "fieldname": "due_date", 
+   "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 1, 
-   "label": "Program", 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Due Date", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Program", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "student_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Details", 
+   "length": 0, 
+   "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -325,6 +448,129 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "program", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 1, 
+   "label": "Program", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Program", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "student_batch", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Batch", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Student Batch Name", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "student_email", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Student Email", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Email", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_16", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "student_category", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -356,6 +602,68 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "academic_term", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Academic Term", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Academic Term", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "academic_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Academic Year", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Academic Year", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_7", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -385,6 +693,68 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "fee_structure", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Fee Structure", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Fee Structure", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "components", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -505,7 +875,7 @@
    "collapsible": 0, 
    "columns": 0, 
    "default": "0", 
-   "fieldname": "total_amount", 
+   "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -514,7 +884,37 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Total Amount", 
+   "label": "Grand Total", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "grand_total_in_words", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "In Words", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -538,7 +938,7 @@
    "default": "0", 
    "fieldname": "paid_amount", 
    "fieldtype": "Currency", 
-   "hidden": 0, 
+   "hidden": 1, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
@@ -590,6 +990,279 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "columns": 0, 
+   "fieldname": "edit_printing_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Printing Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Letter Head", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_32", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Print Heading", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "account", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Accounting", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "receivable_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Receivable Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "income_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Income Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_39", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Cost Center", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 0, 
@@ -603,7 +1276,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-06-30 08:21:48.199858", 
+ "modified": "2017-09-19 16:45:14.313744", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fees", 
diff --git a/erpnext/schools/doctype/fees/fees.py b/erpnext/schools/doctype/fees/fees.py
index 7e660af..d45d6e3 100644
--- a/erpnext/schools/doctype/fees/fees.py
+++ b/erpnext/schools/doctype/fees/fees.py
@@ -4,19 +4,103 @@
 
 from __future__ import unicode_literals
 from frappe.model.document import Document
-import frappe
+import frappe, erpnext
 from frappe import _
+from frappe.utils import money_in_words
+from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
+from frappe.utils.csvutils import getlink
+from erpnext.controllers.accounts_controller import AccountsController
+from erpnext.accounts.general_ledger import delete_gl_entries
 
-class Fees(Document):
+
+class Fees(AccountsController):
+	def set_indicator(self):
+		"""Set indicator for portal"""
+		if self.outstanding_amount > 0:
+			self.indicator_color = "orange"
+			self.indicator_title = _("Unpaid")
+		else:
+			self.indicator_color = "green"
+			self.indicator_title = _("Paid")
+
 	def validate(self):
 		self.calculate_total()
-		
+		self.set_missing_accounts_and_fields()
+
+	def set_missing_accounts_and_fields(self):
+		if not self.company:
+			self.company = frappe.defaults.get_defaults().company
+		if not self.currency:
+			self.currency = erpnext.get_company_currency(self.company)
+		if not (self.receivable_account and self.income_account and self.cost_center):
+			accounts_details = frappe.get_all("Company",
+				fields=["default_receivable_account", "default_income_account", "cost_center"],
+				filters={"name": self.company})[0]
+		if not self.receivable_account:
+			self.receivable_account = accounts_details.default_receivable_account
+		if not self.income_account:
+			self.income_account = accounts_details.default_income_account
+		if not self.cost_center:
+			self.cost_center = accounts_details.cost_center
+		if not self.student_email:
+			self.student_email = self.get_student_emails()
+
+	def get_student_emails(self):
+		student_emails = frappe.db.sql_list("""
+			select g.email_address
+			from `tabGuardian` g, `tabStudent Guardian` sg
+			where g.name = sg.guardian and sg.parent = %s and sg.parenttype = 'Student'
+		""", self.student)
+
+		student_emails.append(frappe.db.get_value("Student", self.student, "student_email_id"))
+		return ", ".join(list(set(student_emails)))
+
+
 	def calculate_total(self):
 		"""Calculates total amount."""
-		self.total_amount = 0
+		self.grand_total = 0
 		for d in self.components:
-			self.total_amount += d.amount
-		self.outstanding_amount = self.total_amount
+			self.grand_total += d.amount
+		self.outstanding_amount = self.grand_total
+		self.grand_total_in_words = money_in_words(self.grand_total)
+
+	def on_submit(self):
+
+		self.make_gl_entries()
+
+		if self.send_payment_request and self.student_email:
+			pr = make_payment_request(dt="Fees", dn=self.name, recipient_id=self.student_email,
+					submit_doc=True, use_dummy_message=True)
+			frappe.msgprint(_("Payment request {0} created").format(getlink("Payment Request", pr.name)))
+
+	def on_cancel(self):
+		delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
+		# frappe.db.set(self, 'status', 'Cancelled')
+
+
+	def make_gl_entries(self):
+		if not self.grand_total:
+			return
+		student_gl_entries =  self.get_gl_dict({
+			"account": self.receivable_account,
+			"party_type": "Student",
+			"party": self.student,
+			"against": self.income_account,
+			"debit": self.grand_total,
+			"debit_in_account_currency": self.grand_total,
+			"against_voucher": self.name,
+			"against_voucher_type": self.doctype
+		})
+		fee_gl_entry = self.get_gl_dict({
+			"account": self.income_account,
+			"against": self.student,
+			"credit": self.grand_total,
+			"credit_in_account_currency": self.grand_total,
+			"cost_center": self.cost_center
+		})
+		from erpnext.accounts.general_ledger import make_gl_entries
+		make_gl_entries([student_gl_entries, fee_gl_entry], cancel=(self.docstatus == 2),
+			update_outstanding="Yes", merge_entries=False)
 
 def get_fee_list(doctype, txt, filters, limit_start, limit_page_length=20, order_by="modified"):
 	user = frappe.session.user
diff --git a/erpnext/schools/doctype/fees/fees_list.js b/erpnext/schools/doctype/fees/fees_list.js
index 2b5c9f6..52e1c4b 100644
--- a/erpnext/schools/doctype/fees/fees_list.js
+++ b/erpnext/schools/doctype/fees/fees_list.js
@@ -1,15 +1,12 @@
 frappe.listview_settings['Fees'] = {
-	add_fields: [ "total_amount", "paid_amount", "due_date"],
+	add_fields: ["grand_total", "outstanding_amount", "due_date"],
 	get_indicator: function(doc) {
-		var { get_today } = frappe.datetime;
-		if ((doc.total_amount > doc.paid_amount) && doc.due_date < get_today()) {
-			return [__("Overdue"), "red", ["due_date,<," + get_today()], ["due_date,<," + get_today()]];
-		}
-		else if (doc.total_amount > doc.paid_amount) {
-			return [__("Pending"), "orange"];
-		}
-		else {
-			return [__("Paid"), "green"];
+		if(flt(doc.outstanding_amount)==0) {
+			return [__("Paid"), "green", "outstanding_amount,=,0"];
+		} else if (flt(doc.outstanding_amount) > 0 && doc.due_date >= frappe.datetime.get_today()) {
+			return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"];
+		} else if (flt(doc.outstanding_amount) > 0 && doc.due_date < frappe.datetime.get_today()) {
+			return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"];
 		}
 	}
 };
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fees/test_fees.js b/erpnext/schools/doctype/fees/test_fees.js
new file mode 100644
index 0000000..22e987e
--- /dev/null
+++ b/erpnext/schools/doctype/fees/test_fees.js
@@ -0,0 +1,31 @@
+/* eslint-disable */
+// rename this file from _test_[name] to test_[name] to activate
+// and remove above this line
+
+QUnit.test("test: Fees", function (assert) {
+	let done = assert.async();
+
+	// number of asserts
+	assert.expect(1);
+
+	frappe.run_serially('Fees', [
+
+		// insert a new Fees
+		() => {
+			return frappe.tests.make('Fees', [
+				{student: 'STUD00001'},
+				{due_date: frappe.datetime.get_today()},
+				{fee_structure: 'FS00001'}
+			]);
+		},
+		() => {
+			assert.equal(cur_frm.doc.grand_total===cur_frm.doc.outstanding_amount);
+		},
+		() => frappe.timeout(0.3),
+		() => cur_frm.save(),
+		() => frappe.tests.click_button('Submit'),
+		() => frappe.tests.click_button('Yes'),
+		() => done()
+	]);
+
+});
diff --git a/erpnext/schools/doctype/fees/test_fees.py b/erpnext/schools/doctype/fees/test_fees.py
index 3ea83ee..283e17b 100644
--- a/erpnext/schools/doctype/fees/test_fees.py
+++ b/erpnext/schools/doctype/fees/test_fees.py
@@ -5,8 +5,49 @@
 
 import frappe
 import unittest
+from frappe.utils import nowdate
+from frappe.utils.make_random import get_random
+
 
 # test_records = frappe.get_test_records('Fees')
 
 class TestFees(unittest.TestCase):
-	pass
+
+	def test_fees(self):
+		student = get_random("Student")
+		fee = frappe.new_doc("Fees")
+		fee.posting_date = nowdate()
+		fee.due_date = nowdate()
+		fee.student = student
+		fee.debit_to = "_Test Receivable - _TC"
+		fee.against_income_account = "Sales - _TC"
+		fee.cost_center = "_Test Cost Center - _TC"
+		fee.company = "_Test Company"
+
+		fee.extend("components", [
+			{
+				"fees_category": "Tuition Fee",
+				"amount": 40000
+			},
+			{
+				"fees_category": "Transportation Fee",
+				"amount": 10000
+			}])
+		fee.save()
+		fee.submit()
+
+		gl_entries = frappe.db.sql("""
+			select account, posting_date, party_type, party, cost_center, fiscal_year, voucher_type,
+			voucher_no, against_voucher_type, against_voucher, cost_center, company, credit, debit
+			from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", ("Fees", fee.name), as_dict=True)
+
+		if gl_entries[0].account == "_Test Receivable - _TC":
+			self.assertEquals(gl_entries[0].debit, 50000)
+			self.assertEquals(gl_entries[0].credit, 0)
+			self.assertEquals(gl_entries[1].debit, 0)
+			self.assertEquals(gl_entries[1].credit, 50000)
+		else:
+			self.assertEquals(gl_entries[0].credit, 50000)
+			self.assertEquals(gl_entries[0].debit, 0)
+			self.assertEquals(gl_entries[1].credit, 0)
+			self.assertEquals(gl_entries[1].debit, 50000)
diff --git a/erpnext/schools/doctype/student/student.json b/erpnext/schools/doctype/student/student.json
index 75cb758..4961c2d 100644
--- a/erpnext/schools/doctype/student/student.json
+++ b/erpnext/schools/doctype/student/student.json
@@ -1114,7 +1114,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-07-07 16:30:08.930882", 
+ "modified": "2017-07-26 19:46:26.893441", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Student", 
diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.js b/erpnext/schools/doctype/student_applicant/student_applicant.js
index 40a6ac3..fdf16ba 100644
--- a/erpnext/schools/doctype/student_applicant/student_applicant.js
+++ b/erpnext/schools/doctype/student_applicant/student_applicant.js
@@ -2,6 +2,10 @@
 // For license information, please see license.txt
 
 frappe.ui.form.on("Student Applicant", {
+	setup: function(frm) {
+		frm.add_fetch("guardian", "guardian_name", "guardian_name");
+	},
+
 	refresh: function(frm) {
 		if(frm.doc.application_status== "Applied" && frm.doc.docstatus== 1 ) {
 			frm.add_custom_button(__("Approve"), function() {
@@ -39,10 +43,11 @@
 			method: "erpnext.schools.api.enroll_student",
 			frm: frm
 		})
-	},
+	}
+});
 
+frappe.ui.form.on('Student Sibling', {
 	setup: function(frm) {
-		frm.add_fetch("guardian", "guardian_name", "guardian_name");
 		frm.add_fetch("student", "title", "full_name");
 		frm.add_fetch("student", "gender", "gender");
 		frm.add_fetch("student", "date_of_birth", "date_of_birth");
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 52dcb73..64cd190 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -18,7 +18,7 @@
 
 	def onload(self):
 		"""Load address and contacts in `__onload`"""
-		load_address_and_contact(self, "customer")
+		load_address_and_contact(self)
 		self.load_dashboard_info()
 
 	def load_dashboard_info(self):
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 87cc7a3..c7bca3c 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -1901,6 +1901,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "description": "In Words will be visible once you save the Quotation.", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -2027,6 +2058,37 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
diff --git a/erpnext/selling/doctype/quotation/tests/test_quotation.js b/erpnext/selling/doctype/quotation/tests/test_quotation.js
index 4e7afe3..1683fa5 100644
--- a/erpnext/selling/doctype/quotation/tests/test_quotation.js
+++ b/erpnext/selling/doctype/quotation/tests/test_quotation.js
@@ -39,7 +39,7 @@
 			assert.ok(cur_frm.doc.contact_display == "Contact 1", "Contact info changed");
 
 			// Check Currency
-			assert.ok(cur_frm.doc_currency == "USD", "Currency Changed");
+			assert.ok(cur_frm.doc.currency == "USD", "Currency Changed");
 			assert.ok(cur_frm.doc.selling_price_list == "Test-Selling-USD", "Price List Changed");
 			assert.ok(cur_frm.doc.items[0].rate == 200, "Price Changed Manually");
 			assert.equal(cur_frm.doc.total, 1000, "New Total Calculated");
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index cdb5dcb..729443d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -1986,6 +1986,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2112,6 +2143,38 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 5f82890..8720482 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -13,7 +13,7 @@
 from frappe.desk.notifications import clear_doctype_notifications
 from frappe.contacts.doctype.address.address import get_company_address
 from erpnext.controllers.selling_controller import SellingController
-from erpnext.subscription.doctype.subscription.subscription import month_map, get_next_date
+from erpnext.accounts.doctype.subscription.subscription import get_next_schedule_date
 
 form_grid_templates = {
 	"items": "templates/form_grid/item_grid.html"
@@ -347,8 +347,7 @@
 		return items
 
 	def on_recurring(self, reference_doc, subscription_doc):
-		mcount = month_map[subscription_doc.frequency]
-		self.set("delivery_date", get_next_date(reference_doc.delivery_date, mcount,
+		self.set("delivery_date", get_next_schedule_date(reference_doc.delivery_date, subscription_doc.frequency,
 			cint(subscription_doc.repeat_on_day)))
 
 		for d in self.get("items"):
@@ -356,7 +355,7 @@
 				{"parent": reference_doc.name, "item_code": d.item_code, "idx": d.idx}, "delivery_date")
 
 			d.set("delivery_date",
-				get_next_date(reference_delivery_date, mcount, cint(subscription_doc.repeat_on_day)))
+				get_next_schedule_date(reference_delivery_date, subscription_doc.frequency, cint(subscription_doc.repeat_on_day)))
 
 def get_list_context(context=None):
 	from erpnext.controllers.website_list_for_contact import get_list_context
diff --git a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js
index 8f1691c..daa8131 100644
--- a/erpnext/selling/doctype/sales_order/tests/test_sales_order.js
+++ b/erpnext/selling/doctype/sales_order/tests/test_sales_order.js
@@ -10,11 +10,8 @@
 				{items: [
 					[
 						{'delivery_date': frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1)},
-						{'qty': 5},
-						{'item_code': 'Test Product 4'},
-						{'uom': 'Nos'},
-						{'margin_type': 'Percentage'},
-						{'discount_percentage': 10},
+						{'qty': 5.123},
+						{'item_code': 'Test Product 3'},
 					]
 				]},
 				{customer_address: 'Test1-Billing'},
@@ -27,31 +24,24 @@
 		},
 		() => {
 			return frappe.tests.set_form_values(cur_frm, [
-				{selling_price_list:'Test-Selling-USD'}
-			]);
-		},
-		() => frappe.timeout(.5),
-		() => {
-			return frappe.tests.set_form_values(cur_frm, [
-				{currency: 'USD'},
-				{apply_discount_on:'Grand Total'},
-				{additional_discount_percentage:10}
+				{selling_price_list:'Test-Selling-USD'},
+				{currency: 'USD'}
 			]);
 		},
 		() => frappe.timeout(1),
 		() => {
 			// get_item_details
-			assert.ok(cur_frm.doc.items[0].item_name=='Test Product 4', "Item name correct");
+			assert.ok(cur_frm.doc.items[0].item_name=='Test Product 3', "Item name correct");
 			// get tax details
 			assert.ok(cur_frm.doc.taxes_and_charges=='TEST In State GST', "Tax details correct");
 			// get tax account head details
 			assert.ok(cur_frm.doc.taxes[0].account_head=='CGST - '+frappe.get_abbr(frappe.defaults.get_default('Company')), " Account Head abbr correct");
 			// calculate totals
-			assert.ok(cur_frm.doc.items[0].price_list_rate==90, "Item 1 price_list_rate");
-			assert.ok(cur_frm.doc.total== 405, "total correct ");
-			assert.ok(cur_frm.doc.net_total== 364.5, "net total correct ");
-			assert.ok(cur_frm.doc.grand_total== 397.30, "grand total correct ");
-			assert.ok(cur_frm.doc.rounded_total== 397.30, "rounded total correct ");
+			assert.ok(cur_frm.doc.items[0].price_list_rate==250, "Item 1 price_list_rate");
+			assert.ok(cur_frm.doc.net_total== 1280.75, "net total correct ");
+			assert.ok(cur_frm.doc.base_grand_total== flt(1511.29* cur_frm.doc.conversion_rate, precision('base_grand_total')), "base round total correct ");
+			assert.ok(cur_frm.doc.grand_total== 1511.29 , "grand total correct ");
+			assert.ok(cur_frm.doc.rounded_total== 1511.30, "rounded total correct ");
 		},
 		() => cur_frm.save(),
 		() => frappe.timeout(1),
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.py b/erpnext/selling/doctype/selling_settings/selling_settings.py
index ee7d203..d297883 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.py
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.py
@@ -8,6 +8,7 @@
 import frappe.defaults
 from frappe.utils import cint
 from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+from frappe.utils.nestedset import get_root_of
 
 from frappe.model.document import Document
 
@@ -31,3 +32,9 @@
 		for doctype in ("Sales Order", "Sales Invoice", "Delivery Note"):
 			make_property_setter(doctype, "tax_id", "hidden", self.hide_tax_id, "Check")
 			make_property_setter(doctype, "tax_id", "print_hide", self.hide_tax_id, "Check")
+
+	def set_default_customer_group_and_territory(self):
+		if not self.customer_group:
+			self.customer_group = get_root_of('Customer Group')
+		if not self.territory:
+			self.territory = get_root_of('Territory')
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index 15e6b4b..ec83705 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -1,198 +1,198 @@
 {
- "allow_copy": 0, 
- "allow_guest_to_view": 0, 
- "allow_import": 1, 
- "allow_rename": 1, 
- "autoname": "field:company_name", 
- "beta": 0, 
- "creation": "2013-04-10 08:35:39", 
- "custom": 0, 
- "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.", 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Setup", 
- "editable_grid": 0, 
- "engine": "InnoDB", 
+ "allow_copy": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "field:company_name",
+ "beta": 0,
+ "creation": "2013-04-10 08:35:39",
+ "custom": 0,
+ "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "editable_grid": 0,
+ "engine": "InnoDB",
  "fields": [
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "details", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "details",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "company_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Company", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "company_name", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "company_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Company",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "company_name",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "abbr", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Abbr", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "abbr", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "description": "",
+   "fieldname": "abbr",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Abbr",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "abbr",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")", 
-   "fieldname": "change_abbr", 
-   "fieldtype": "Button", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Change Abbreviation", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")",
+   "fieldname": "change_abbr",
+   "fieldtype": "Button",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Change Abbreviation",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "cb0", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "cb0",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "domain", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Domain", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Distribution\nManufacturing\nRetail\nServices\nEducation\nOther", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "domain",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Domain",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Distribution\nManufacturing\nRetail\nServices\nEducation\nHealthcare\nOther",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
   }, 
   {
@@ -650,1332 +650,1332 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "default_settings", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Accounts Settings", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "default_settings",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Accounts Settings",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_bank_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Bank Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "default_bank_account", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_bank_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Bank Account",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "default_bank_account",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_cash_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Cash Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_cash_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Cash Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_receivable_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Receivable Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "receivables_group", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_receivable_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Receivable Account",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "receivables_group",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "round_off_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Round Off Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "round_off_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Round Off Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "write_off_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Write Off Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "write_off_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Write Off Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "exchange_gain_loss_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Exchange Gain / Loss Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "exchange_gain_loss_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Exchange Gain / Loss Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break0", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break0",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_payable_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Payable Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "payables_group", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_payable_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Payable Account",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "payables_group",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_expense_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Cost of Goods Sold Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_expense_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Cost of Goods Sold Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_income_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Income Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_income_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Income Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "default_payroll_payable_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Payroll Payable Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "default_payroll_payable_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Payroll Payable Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "round_off_cost_center", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Round Off Cost Center", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Cost Center", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "round_off_cost_center",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Round Off Cost Center",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Cost Center",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "section_break_22", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "section_break_22",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "cost_center", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Cost Center", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Cost Center", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "cost_center",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Cost Center",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Cost Center",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "credit_limit", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Credit Limit", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "credit_limit", 
-   "oldfieldtype": "Currency", 
-   "options": "default_currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "credit_limit",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Credit Limit",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "credit_limit",
+   "oldfieldtype": "Currency",
+   "options": "default_currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_26", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_26",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "credit_days_based_on", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Credit Days Based On", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nFixed Days\nLast Day of the Next Month", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "credit_days_based_on",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Credit Days Based On",
+   "length": 0,
+   "no_copy": 0,
+   "options": "\nFixed Days\nLast Day of the Next Month",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')", 
-   "fieldname": "credit_days", 
-   "fieldtype": "Int", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Credit Days", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "credit_days", 
-   "oldfieldtype": "Int", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')",
+   "fieldname": "credit_days",
+   "fieldtype": "Int",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Credit Days",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "credit_days",
+   "oldfieldtype": "Int",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "auto_accounting_for_stock_settings", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Stock Settings", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "depends_on": "eval:!doc.__islocal",
+   "fieldname": "auto_accounting_for_stock_settings",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Stock Settings",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "default": "1", 
-   "fieldname": "enable_perpetual_inventory", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Enable Perpetual Inventory", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "default": "1",
+   "fieldname": "enable_perpetual_inventory",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Enable Perpetual Inventory",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "default_inventory_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Default Inventory Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "default_inventory_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Default Inventory Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "stock_adjustment_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Stock Adjustment Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "stock_adjustment_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Stock Adjustment Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_32", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_32",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "stock_received_but_not_billed", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Stock Received But Not Billed", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "stock_received_but_not_billed",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Stock Received But Not Billed",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "expenses_included_in_valuation", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Expenses Included In Valuation", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "expenses_included_in_valuation",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Expenses Included In Valuation",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "fixed_asset_depreciation_settings", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Fixed Asset Depreciation Settings", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "fixed_asset_depreciation_settings",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Fixed Asset Depreciation Settings",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "accumulated_depreciation_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Accumulated Depreciation Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "accumulated_depreciation_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Accumulated Depreciation Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "depreciation_expense_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Depreciation Expense Account", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "depreciation_expense_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Depreciation Expense Account",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "series_for_depreciation_entry", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Series for Asset Depreciation Entry (Journal Entry)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "series_for_depreciation_entry",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Series for Asset Depreciation Entry (Journal Entry)",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_40", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break_40",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "disposal_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Gain/Loss Account on Asset Disposal", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "disposal_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Gain/Loss Account on Asset Disposal",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Account",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "depreciation_cost_center", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Asset Depreciation Cost Center", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Cost Center", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "depreciation_cost_center",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Asset Depreciation Cost Center",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Cost Center",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "For reference only.", 
-   "fieldname": "company_info", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Company Info", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "description": "For reference only.",
+   "fieldname": "company_info",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Company Info",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "address_html", 
-   "fieldtype": "HTML", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "address_html",
+   "fieldtype": "HTML",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "column_break1",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Column Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "phone_no", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Phone No", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "phone_no", 
-   "oldfieldtype": "Data", 
-   "options": "Phone", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "phone_no",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Phone No",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "phone_no",
+   "oldfieldtype": "Data",
+   "options": "Phone",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "fax", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Fax", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "fax", 
-   "oldfieldtype": "Data", 
-   "options": "Phone", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "fax",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Fax",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "fax",
+   "oldfieldtype": "Data",
+   "options": "Phone",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "email", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Email", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "email", 
-   "oldfieldtype": "Data", 
-   "options": "Email", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "email",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Email",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "email",
+   "oldfieldtype": "Data",
+   "options": "Email",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "website", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Website", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "website", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "website",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Website",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "website",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "", 
-   "fieldname": "registration_info", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldtype": "Section Break", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "description": "",
+   "fieldname": "registration_info",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldtype": "Section Break",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "50%"
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "description": "Company registration numbers for your reference. Tax numbers etc.", 
-   "fieldname": "registration_details", 
-   "fieldtype": "Code", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Registration Details", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "registration_details", 
-   "oldfieldtype": "Code", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "description": "Company registration numbers for your reference. Tax numbers etc.",
+   "fieldname": "registration_details",
+   "fieldtype": "Code",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Registration Details",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "registration_details",
+   "oldfieldtype": "Code",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "delete_company_transactions", 
-   "fieldtype": "Button", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Delete Company Transactions", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_bulk_edit": 0,
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "columns": 0,
+   "fieldname": "delete_company_transactions",
+   "fieldtype": "Button",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_global_search": 0,
+   "in_list_view": 0,
+   "in_standard_filter": 0,
+   "label": "Delete Company Transactions",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "remember_last_selected_value": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
   }
  ], 
@@ -1998,151 +1998,151 @@
  "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "System Manager", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "set_user_permissions": 0,
+   "share": 1,
+   "submit": 0,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Accounts User", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 1,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 1,
+   "read": 1,
+   "report": 0,
+   "role": "Accounts User",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Employee", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 0,
+   "read": 1,
+   "report": 0,
+   "role": "Employee",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Sales User", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 0,
+   "read": 1,
+   "report": 0,
+   "role": "Sales User",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Purchase User", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 0,
+   "read": 1,
+   "report": 0,
+   "role": "Purchase User",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Stock User", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 0,
+   "read": 1,
+   "report": 0,
+   "role": "Stock User",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
-  }, 
+  },
   {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Projects User", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
+   "amend": 0,
+   "apply_user_permissions": 0,
+   "cancel": 0,
+   "create": 0,
+   "delete": 0,
+   "email": 0,
+   "export": 0,
+   "if_owner": 0,
+   "import": 0,
+   "permlevel": 0,
+   "print": 0,
+   "read": 1,
+   "report": 0,
+   "role": "Projects User",
+   "set_user_permissions": 0,
+   "share": 0,
+   "submit": 0,
    "write": 0
   }
- ], 
- "quick_entry": 0, 
- "read_only": 0, 
- "read_only_onload": 0, 
- "show_name_in_global_search": 1, 
- "sort_order": "ASC", 
- "track_changes": 1, 
+ ],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 1,
+ "sort_order": "ASC",
+ "track_changes": 1,
  "track_seen": 0
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index d3503cc..1c9ea84 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -278,6 +278,8 @@
 		frappe.db.sql("""update `tabSingles` set value=""
 			where doctype='Global Defaults' and field='default_company'
 			and value=%s""", self.name)
+		# delete mode of payment account
+		frappe.db.sql("delete from `tabMode of Payment Account` where company=%s", self.name)
 
 @frappe.whitelist()
 def replace_abbr(company, old, new):
diff --git a/erpnext/setup/doctype/company/tests/test_company.js b/erpnext/setup/doctype/company/tests/test_company.js
index afa3296..8c0b609 100644
--- a/erpnext/setup/doctype/company/tests/test_company.js
+++ b/erpnext/setup/doctype/company/tests/test_company.js
@@ -1,7 +1,7 @@
 QUnit.module('setup');
 
 QUnit.test("Test: Company [SetUp]", function (assert) {
-	assert.expect(1);
+	assert.expect(2);
 	let done = assert.async();
 
 	frappe.run_serially([
@@ -16,8 +16,10 @@
 		// save form
 		() => cur_frm.save(),
 		() => frappe.timeout(1),
-		() => assert.equal("Test Company", cur_frm.doc.company_name,
-			'name of company correctly saved'),
+		() => assert.equal("Debtors - TC", cur_frm.doc.default_receivable_account,
+			'chart of acounts created'),
+		() => assert.equal("Main - TC", cur_frm.doc.cost_center,
+			'chart of cost centers created'),
 		() => done()
 	]);
 });
\ No newline at end of file
diff --git a/erpnext/setup/doctype/company/tests/test_company_production.js b/erpnext/setup/doctype/company/tests/test_company_production.js
index b73af1d..37a3d74 100644
--- a/erpnext/setup/doctype/company/tests/test_company_production.js
+++ b/erpnext/setup/doctype/company/tests/test_company_production.js
@@ -8,7 +8,7 @@
 		() => frappe.set_route("List", "Company"),
 		() => frappe.new_doc("Company"),
 		() => frappe.timeout(1),
-		() => cur_frm.set_value("company_name", "Razer Blade"),
+		() => cur_frm.set_value("company_name", "For Testing"),
 		() => cur_frm.set_value("abbr", "RB"),
 		() => cur_frm.set_value("default_currency", "INR"),
 		() => cur_frm.save(),
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py
index e6b26ee..675f9ca 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.py
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.py
@@ -16,7 +16,7 @@
 
 	def onload(self):
 		"""Load address and contacts in `__onload`"""
-		load_address_and_contact(self, "sales_partner")
+		load_address_and_contact(self)
 
 	def autoname(self):
 		self.name = self.partner_name
diff --git a/erpnext/setup/doctype/setup_progress/setup_progress.py b/erpnext/setup/doctype/setup_progress/setup_progress.py
index 26eecd9..9187eb7 100644
--- a/erpnext/setup/doctype/setup_progress/setup_progress.py
+++ b/erpnext/setup/doctype/setup_progress/setup_progress.py
@@ -24,10 +24,21 @@
 		if d.action_name == action_name][0]
 	update_action(action_table_doc)
 
-def update_action(action_table_doc):
-	if not action_table_doc.is_completed and frappe.db.count(action_table_doc.action_doctype) >= action_table_doc.min_doc_count:
-		action_table_doc.is_completed = 1
-		action_table_doc.save()
+def update_action(doc):
+	doctype = doc.action_doctype
+	docname = doc.action_document
+	field = doc.action_field
+
+	if not doc.is_completed:
+		if doc.min_doc_count:
+			if frappe.db.count(doctype) >= doc.min_doc_count:
+				doc.is_completed = 1
+				doc.save()
+		if docname and field:
+			d = frappe.get_doc(doctype, docname)
+			if d.get(field):
+				doc.is_completed = 1
+				doc.save()
 
 def update_domain_actions(domain):
 	for d in get_setup_progress().actions:
diff --git a/erpnext/setup/doctype/setup_progress_action/setup_progress_action.json b/erpnext/setup/doctype/setup_progress_action/setup_progress_action.json
index 030fd99..e9abcbc 100644
--- a/erpnext/setup/doctype/setup_progress_action/setup_progress_action.json
+++ b/erpnext/setup/doctype/setup_progress_action/setup_progress_action.json
@@ -79,6 +79,67 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "action_document", 
+   "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Action Document", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "action_doctype", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "action_field", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Action Field", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "min_doc_count", 
    "fieldtype": "Int", 
    "hidden": 0, 
@@ -174,7 +235,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-08-28 17:44:58.008526", 
+ "modified": "2017-09-01 14:34:59.685730", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Setup Progress Action", 
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 9bf15ce..81f909a 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -5,6 +5,8 @@
 
 import frappe
 from frappe import _
+from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
+from frappe.custom.doctype.custom_field.custom_field import create_custom_field
 
 default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
 	<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
@@ -13,7 +15,7 @@
 	frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
 	set_single_defaults()
 	create_compact_item_print_custom_field()
-	from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
+	create_print_zero_amount_taxes_custom_field()
 	add_all_roles_to("Administrator")
 	frappe.db.commit()
 
@@ -44,11 +46,19 @@
 	frappe.db.set_default("date_format", "dd-mm-yyyy")
 
 def create_compact_item_print_custom_field():
-	from frappe.custom.doctype.custom_field.custom_field import create_custom_field
 	create_custom_field('Print Settings', {
 		'label': _('Compact Item Print'),
 		'fieldname': 'compact_item_print',
 		'fieldtype': 'Check',
 		'default': 1,
 		'insert_after': 'with_letterhead'
+	})
+
+def create_print_zero_amount_taxes_custom_field():
+	create_custom_field('Print Settings', {
+		'label': _('Print taxes with zero amount'),
+		'fieldname': 'print_taxes_with_zero_amount',
+		'fieldtype': 'Check',
+		'default': 0,
+		'insert_after': 'allow_print_for_cancelled'
 	})
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py
index 7f333cc..ddb2a80 100644
--- a/erpnext/setup/setup_wizard/domainify.py
+++ b/erpnext/setup/setup_wizard/domainify.py
@@ -12,7 +12,8 @@
 			'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
 				'Production Order',  'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling',
 				 'Accounts', 'HR', 'ToDo'],
-			'remove_roles': ['Academics User', 'Instructor'],
+			'remove_roles': ['Academics User', 'Instructor', 'Physician', 'Nursing User',
+				'Laboratory user', 'LabTest Approver', 'Healthcare Administrator'],
 			'properties': [
 				{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'collapsible_depends_on', 'value': 'is_stock_item'},
 			],
@@ -25,7 +26,9 @@
 		'Retail': {
 			'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice',  'Purchase Order',
 			'Warranty Claim', 'Accounts', 'Task', 'Buying', 'ToDo'],
-			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
+			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor',
+				'Physician', 'Nursing User', 'Laboratory user',
+				'LabTest Approver', 'Healthcare Administrator'],
 			'properties': [
 				{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1},
 				{'doctype': 'Customer', 'fieldname': 'credit_limit_section', 'property': 'hidden', 'value': 1},
@@ -39,7 +42,9 @@
 		'Distribution': {
 			'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order', 'Task',
 				 'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR', 'ToDo'],
-			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
+			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor',
+				'Physician', 'Nursing User', 'Laboratory user',
+				'LabTest Approver', 'Healthcare Administrator'],
 			'set_value': [
 				['Stock Settings', None, 'show_barcode_field', 1]
 			],
@@ -49,7 +54,9 @@
 		'Services': {
 			'desktop_icons': ['Project', 'Timesheet', 'Customer', 'Sales Order', 'Sales Invoice',
 				'Lead', 'Opportunity', 'Task', 'Expense Claim', 'Employee', 'HR', 'ToDo'],
-			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
+			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor',
+				'Physician', 'Nursing User', 'Laboratory user',
+				'LabTest Approver', 'Healthcare Administrator'],
 			'properties': [
 				{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
 			],
@@ -66,6 +73,13 @@
 				'Student', 'Projects User', 'Instructor'],
 			'default_portal_role': 'Student'
 		},
+		'Healthcare': {
+			'desktop_icons': ['Patient', 'Patient Appointment', 'Consultation', 'Lab Test', 'Healthcare',
+				'Accounts',  'Buying', 'Stock', 'HR', 'ToDo'],
+			'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Projects User', 'Projects Manager',
+				'Academics User', 'Instructor'],
+			'default_portal_role': 'Patient'
+		},
 	}
 	if not domain in data:
 		raise 'Invalid Domain {0}'.format(domain)
diff --git a/erpnext/setup/setup_wizard/healthcare.py b/erpnext/setup/setup_wizard/healthcare.py
new file mode 100644
index 0000000..ebc644e
--- /dev/null
+++ b/erpnext/setup/setup_wizard/healthcare.py
@@ -0,0 +1,281 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
+from frappe import _
+
+def setup_healthcare():
+	create_medical_departments()
+	create_antibiotics()
+	create_test_uom()
+	create_duration()
+	create_dosage()
+	create_healthcare_item_groups()
+	create_lab_test_items()
+	create_lab_test_template()
+	create_sensitivity()
+	make_custom_fields()
+
+def make_custom_fields():
+	custom_fields = {
+		'Sales Invoice': [
+			dict(fieldname='appointment', label='Patient Appointment',
+				fieldtype='Link', options='Patient Appointment',
+				insert_after='customer')
+		]
+	}
+
+	create_custom_fields(custom_fields)
+
+
+def create_medical_departments():
+	depts = ["Accident and emergency care" ,"Anaesthetics", "Biochemistry", "Cardiology", "Dermatology",
+				"Diagnostic imaging", "ENT", "Gastroenterology", "General Surgery", "Gynaecology",
+				"Haematology", "Maternity", "Microbiology", "Nephrology", "Neurology", "Oncology",
+				 "Orthopaedics", "Pathology", "Physiotherapy", "Rheumatology", "Serology", "Urology"]
+	for d in depts:
+		mediacal_department = frappe.new_doc("Medical Department")
+		mediacal_department.department = d
+		try:
+			mediacal_department.save()
+		except frappe.DuplicateEntryError:
+			pass
+
+def create_antibiotics():
+	abt = ["Amoxicillin", "Ampicillin", "Bacampicillin", "Carbenicillin", "Cloxacillin", "Dicloxacillin",
+	 "Flucloxacillin", "Mezlocillin", "Nafcillin", "Oxacillin", "Penicillin G", "Penicillin V",
+	 "Piperacillin", "Pivampicillin", "Pivmecillinam", "Ticarcillin", "Cefacetrile (cephacetrile)",
+	 "Cefadroxil (cefadroxyl)", "Cefalexin (cephalexin)", "Cefaloglycin (cephaloglycin)",
+	 "Cefalonium (cephalonium)", "Cefaloridine (cephaloradine)", "Cefalotin (cephalothin)",
+	 "Cefapirin (cephapirin)", "Cefatrizine", "Cefazaflur", "Cefazedone", "Cefazolin (cephazolin)",
+	 "Cefradine (cephradine)", "Cefroxadine", "Ceftezole", "Cefaclor", "Cefamandole", "Cefmetazole",
+	 "Cefonicid", "Cefotetan", "Cefoxitin", "Cefprozil (cefproxil)", "Cefuroxime", "Cefuzonam",
+	 "Cefcapene", "Cefdaloxime", "Cefdinir", "Cefditoren", "Cefetamet", "Cefixime", "Cefmenoxime",
+	 "Cefodizime", "Cefotaxime", "Cefpimizole", "Cefpodoxime", "Cefteram", "Ceftibuten", "Ceftiofur",
+	 "Ceftiolene", "Ceftizoxime", "Ceftriaxone", "Cefoperazone", "Ceftazidime", "Cefclidine", "Cefepime",
+	 "Cefluprenam", "Cefoselis", "Cefozopran", "Cefpirome", "Cefquinome", "Ceftobiprole", "Ceftaroline",
+	 "Cefaclomezine","Cefaloram", "Cefaparole", "Cefcanel", "Cefedrolor", "Cefempidone", "Cefetrizole",
+	 "Cefivitril", "Cefmatilen", "Cefmepidium", "Cefovecin", "Cefoxazole", "Cefrotil", "Cefsumide",
+	 "Cefuracetime", "Ceftioxide", "Ceftazidime/Avibactam", "Ceftolozane/Tazobactam", "Aztreonam",
+	 "Imipenem", "Imipenem/cilastatin", "Doripenem", "Meropenem", "Ertapenem", "Azithromycin",
+	 "Erythromycin", "Clarithromycin", "Dirithromycin", "Roxithromycin", "Telithromycin", "Clindamycin",
+	 "Lincomycin", "Pristinamycin", "Quinupristin/dalfopristin", "Amikacin", "Gentamicin", "Kanamycin",
+	 "Neomycin", "Netilmicin", "Paromomycin", "Streptomycin", "Tobramycin", "Flumequine", "Nalidixic acid",
+	 "Oxolinic acid", "Piromidic acid", "Pipemidic acid", "Rosoxacin", "Ciprofloxacin", "Enoxacin",
+	 "Lomefloxacin", "Nadifloxacin", "Norfloxacin", "Ofloxacin", "Pefloxacin", "Rufloxacin", "Balofloxacin",
+	 "Gatifloxacin", "Grepafloxacin", "Levofloxacin", "Moxifloxacin", "Pazufloxacin", "Sparfloxacin",
+	 "Temafloxacin", "Tosufloxacin", "Besifloxacin", "Clinafloxacin", "Gemifloxacin",
+	 "Sitafloxacin", "Trovafloxacin", "Prulifloxacin", "Sulfamethizole", "Sulfamethoxazole",
+	 "Sulfisoxazole", "Trimethoprim-Sulfamethoxazole", "Demeclocycline", "Doxycycline", "Minocycline",
+	 "Oxytetracycline", "Tetracycline", "Tigecycline", "Chloramphenicol", "Metronidazole",
+	 "Tinidazole", "Nitrofurantoin", "Vancomycin", "Teicoplanin", "Telavancin", "Linezolid",
+	 "Cycloserine 2", "Rifampin", "Rifabutin", "Rifapentine", "Rifalazil", "Bacitracin", "Polymyxin B",
+	 "Viomycin", "Capreomycin"]
+	for a in abt:
+		antibiotic = frappe.new_doc("Antibiotic")
+		antibiotic.antibiotic_name = a
+		try:
+			antibiotic.save()
+		except frappe.DuplicateEntryError:
+			pass
+
+def create_test_uom():
+	records = [
+		{"doctype": "Lab Test UOM", "name": "umol/L", "test_uom": "umol/L", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "mg/L", "test_uom": "mg/L", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "mg / dl", "test_uom": "mg / dl", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "pg / ml", "test_uom": "pg / ml", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "U/ml", "test_uom": "U/ml", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "/HPF", "test_uom": "/HPF", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "Million Cells / cumm", "test_uom": "Million Cells / cumm", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "Lakhs Cells / cumm", "test_uom": "Lakhs Cells / cumm", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "U / L", "test_uom": "U / L", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "g / L", "test_uom": "g / L", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "IU / ml", "test_uom": "IU / ml", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "gm %", "test_uom": "gm %", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "Microgram", "test_uom": "Microgram", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "Micron", "test_uom": "Micron", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "Cells / cumm", "test_uom": "Cells / cumm", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "%", "test_uom": "%", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "mm / dl", "test_uom": "mm / dl", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "mm / hr", "test_uom": "mm / hr", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "ulU / ml", "test_uom": "ulU / ml", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "ng / ml", "test_uom": "ng / ml", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "ng / dl", "test_uom": "ng / dl", "uom_description": None },
+		{"doctype": "Lab Test UOM", "name": "ug / dl", "test_uom": "ug / dl", "uom_description": None }
+	]
+
+	insert_record(records)
+
+def create_duration():
+	records = [
+		{"doctype": "Prescription Duration", "name": "3 Month", "number": "3", "period": "Month" },
+		{"doctype": "Prescription Duration", "name": "2 Month", "number": "2", "period": "Month" },
+		{"doctype": "Prescription Duration", "name": "1 Month", "number": "1", "period": "Month" },
+		{"doctype": "Prescription Duration", "name": "12 Hour", "number": "12", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "11 Hour", "number": "11", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "10 Hour", "number": "10", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "9 Hour", "number": "9", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "8 Hour", "number": "8", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "7 Hour", "number": "7", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "6 Hour", "number": "6", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "5 Hour", "number": "5", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "4 Hour", "number": "4", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "3 Hour", "number": "3", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "2 Hour", "number": "2", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "1 Hour", "number": "1", "period": "Hour" },
+		{"doctype": "Prescription Duration", "name": "5 Week", "number": "5", "period": "Week" },
+		{"doctype": "Prescription Duration", "name": "4 Week", "number": "4", "period": "Week" },
+		{"doctype": "Prescription Duration", "name": "3 Week", "number": "3", "period": "Week" },
+		{"doctype": "Prescription Duration", "name": "2 Week", "number": "2", "period": "Week" },
+		{"doctype": "Prescription Duration", "name": "1 Week", "number": "1", "period": "Week" },
+		{"doctype": "Prescription Duration", "name": "6 Day", "number": "6", "period": "Day" },
+		{"doctype": "Prescription Duration", "name": "5 Day", "number": "5", "period": "Day" },
+		{"doctype": "Prescription Duration", "name": "4 Day", "number": "4", "period": "Day" },
+		{"doctype": "Prescription Duration", "name": "3 Day", "number": "3", "period": "Day" },
+		{"doctype": "Prescription Duration", "name": "2 Day", "number": "2", "period": "Day" },
+		{"doctype": "Prescription Duration", "name": "1 Day", "number": "1", "period": "Day" }
+	]
+	insert_record(records)
+
+def create_dosage():
+	records = [
+		{"doctype": "Prescription Dosage", "name": "1-1-1-1", "dosage": "1-1-1-1","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "0-0-1", "dosage": "0-0-1","dosage_strength":
+		[{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "1-0-0", "dosage": "1-0-0","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "0-1-0", "dosage": "0-1-0","dosage_strength":
+		[{"strength": "1.0","strength_time": "14:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "1-1-1", "dosage": "1-1-1","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "1-0-1", "dosage": "1-0-1","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "Once Bedtime", "dosage": "Once Bedtime","dosage_strength":
+		[{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "5 times a day", "dosage": "5 times a day","dosage_strength":
+		[{"strength": "1.0","strength_time": "5:00:00"}, {"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "QID", "dosage": "QID","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "13:00:00"},{"strength": "1.0","strength_time": "17:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "TID", "dosage": "TID","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "14:00:00"},{"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "BID", "dosage": "BID","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}, {"strength": "1.0","strength_time": "21:00:00"}]
+		},
+		{"doctype": "Prescription Dosage", "name": "Once Daily", "dosage": "Once Daily","dosage_strength":
+		[{"strength": "1.0","strength_time": "9:00:00"}]
+		}
+	]
+	insert_record(records)
+
+def create_healthcare_item_groups():
+	records = [
+		{'doctype': 'Item Group', 'item_group_name': _('Laboratory'),
+			'is_group': 0, 'parent_item_group': _('All Item Groups') },
+		{'doctype': 'Item Group', 'item_group_name': _('Drug'),
+			'is_group': 0, 'parent_item_group': _('All Item Groups') }
+	]
+	insert_record(records)
+
+def create_lab_test_items():
+	records = [
+		{"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
+		{"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": "Laboratory",
+			"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
+	]
+	insert_record(records)
+
+def create_lab_test_template():
+	records = [
+		{"doctype": "Lab Test Template", "name": "MCH","test_name": "MCH","test_code": "MCH",
+		"test_group": "Laboratory","department": "Haematology","item": "MCH",
+		"test_template_type": "Single","is_billable": 1,"test_rate": 0.0,"test_uom": "Microgram",
+		"test_normal_range": "27 - 32 Microgram",
+		"sensitivity": 0,"test_description": "Mean Corpuscular Hemoglobin"},
+		{"doctype": "Lab Test Template", "name": "LDL","test_name": "LDL (Serum)","test_code": "LDL",
+		"test_group": "Laboratory","department": "Biochemistry",
+		"item": "LDL","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "70 - 160 mg/dlLow-density Lipoprotein (LDL)",
+		"sensitivity": 0,"test_description": "Low-density Lipoprotein (LDL)"},
+		{"doctype": "Lab Test Template", "name": "GTT","test_name": "GTT","test_code": "GTT",
+		"test_group": "Laboratory","department": "Haematology",
+		"item": "GTT","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "Less than 85 mg/dl",
+		"sensitivity": 0,"test_description": "Glucose Tolerance Test"},
+		{"doctype": "Lab Test Template", "name": "HDL","test_name": "HDL (Serum)","test_code": "HDL",
+		"test_group": "Laboratory","department": "Biochemistry",
+		"item": "HDL","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "35 - 65 mg/dl",
+		"sensitivity": 0,"test_description": "High-density Lipoprotein (HDL)"},
+		{"doctype": "Lab Test Template", "name": "BILT","test_name": "Bilirubin Total","test_code": "BILT",
+		"test_group": "Laboratory","department": "Biochemistry",
+		"item": "BILT","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.2 - 1.2 mg / dl",
+		"sensitivity": 0,"test_description": "Bilirubin Total"},
+		{"doctype": "Lab Test Template", "name": "BILD","test_name": "Bilirubin Direct","test_code": "BILD",
+		"test_group": "Laboratory","department": "Biochemistry",
+		"item": "BILD","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "mg / dl","test_normal_range": "0.4 mg / dl",
+		"sensitivity": 0,"test_description": "Bilirubin Direct"},
+
+		{"doctype": "Lab Test Template", "name": "BP","test_name": "Bile Pigment","test_code": "BP",
+		"test_group": "Laboratory","department": "Pathology",
+		"item": "BP","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "",
+		"sensitivity": 0,"test_description": "Bile Pigment"},
+		{"doctype": "Lab Test Template", "name": "BS","test_name": "Bile Salt","test_code": "BS",
+		"test_group": "Laboratory","department": "Pathology",
+		"item": "BS","test_template_type": "Single",
+		"is_billable": 1,"test_rate": 0.0,"test_uom": "","test_normal_range": "",
+		"sensitivity": 0,"test_description": "Bile Salt"}
+	]
+	insert_record(records)
+
+def create_sensitivity():
+	records = [
+		{"doctype": "Sensitivity", "sensitivity": "Low Sensitivity"},
+		{"doctype": "Sensitivity", "sensitivity": "High Sensitivity"},
+		{"doctype": "Sensitivity", "sensitivity": "Moderate Sensitivity"},
+		{"doctype": "Sensitivity", "sensitivity": "Susceptible"},
+		{"doctype": "Sensitivity", "sensitivity": "Resistant"},
+		{"doctype": "Sensitivity", "sensitivity": "Intermediate"}
+	]
+	insert_record(records)
+
+def insert_record(records):
+	for r in records:
+		doc = frappe.new_doc(r.get("doctype"))
+		doc.update(r)
+		try:
+			doc.insert(ignore_permissions=True)
+		except frappe.DuplicateEntryError, e:
+			# pass DuplicateEntryError and continue
+			if e.args and e.args[0]==doc.doctype and e.args[1]==doc.name:
+				# make sure DuplicateEntryError is for the exact same doc and not a related doc
+				pass
+			else:
+				raise
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index 53e58a1..67d7e93 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -19,11 +19,16 @@
 		{ 'doctype': 'Domain', 'domain': _('Retail')},
 		{ 'doctype': 'Domain', 'domain': _('Services')},
 		{ 'doctype': 'Domain', 'domain': _('Education')},
+		{ 'doctype': 'Domain', 'domain': _('Healthcare')},
 
 		# Setup Progress
 		{'doctype': "Setup Progress", "actions": [
 			{"action_name": _("Add Company"), "action_doctype": "Company", "min_doc_count": 1, "is_completed": 1,
 				"domains": '[]' },
+			{"action_name": _("Set Sales Target"), "action_doctype": "Company", "min_doc_count": 99,
+				"action_document": frappe.defaults.get_defaults().get("company") or '',
+				"action_field": "monthly_sales_target", "is_completed": 0,
+				"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
 			{"action_name": _("Add Customers"), "action_doctype": "Customer", "min_doc_count": 1, "is_completed": 0,
 				"domains": '["Manufacturing", "Services", "Retail", "Distribution"]' },
 			{"action_name": _("Add Suppliers"), "action_doctype": "Supplier", "min_doc_count": 1, "is_completed": 0,
@@ -262,3 +267,8 @@
 				pass
 			else:
 				raise
+
+	# set default customer group and territory
+	selling_settings = frappe.get_doc("Selling Settings")
+	selling_settings.set_default_customer_group_and_territory()
+	selling_settings.save()
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 40d11e5..d3e4a08 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -10,6 +10,7 @@
 from frappe import _
 from frappe.utils.file_manager import save_file
 from .default_website import website_maker
+from .healthcare import setup_healthcare
 import install_fixtures
 from .sample_data import make_sample_data
 from erpnext.accounts.doctype.account.account import RootNotEditable
@@ -37,6 +38,9 @@
 		create_academic_year()
 		create_academic_term()
 
+	if args.domain.lower() == 'healthcare':
+		setup_healthcare()
+
 	if args.get('setup_website'):
 		website_maker(args)
 
@@ -154,7 +158,9 @@
 
 	global_defaults.save()
 
-	frappe.db.set_value("System Settings", None, "email_footer_address", args.get("company"))
+	system_settings = frappe.get_doc("System Settings")
+	system_settings.email_footer_address = args.get("company")
+	system_settings.save()
 
 	stock_settings = frappe.get_doc("Stock Settings")
 	stock_settings.item_naming_by = "Item Code"
@@ -414,3 +420,4 @@
 			academic_year.save()
 		except frappe.DuplicateEntryError:
 			pass
+
diff --git a/erpnext/setup/setup_wizard/test_setup_wizard.py b/erpnext/setup/setup_wizard/test_setup_wizard.py
index 67b6f43..57eeeff 100644
--- a/erpnext/setup/setup_wizard/test_setup_wizard.py
+++ b/erpnext/setup/setup_wizard/test_setup_wizard.py
@@ -15,16 +15,16 @@
 	print('Running Setup Wizard Test...')
 
 	# Language slide
+	driver.wait_for_ajax(True)
+	time.sleep(2)
 	driver.set_select("language", "English (United States)")
 	driver.wait_for_ajax(True)
-	driver.wait_for('.next-btn', timeout=100)
 	driver.wait_till_clickable(".next-btn").click()
 
 	# Region slide
 	driver.wait_for_ajax(True)
 	driver.set_select("country", "India")
 	driver.wait_for_ajax(True)
-	driver.wait_for('.next-btn', timeout=100)
 	driver.wait_till_clickable(".next-btn").click()
 
 	# Profile slide
@@ -35,6 +35,7 @@
 
 	# Brand slide
 	driver.set_select("domain", "Manufacturing")
+	time.sleep(5)
 	driver.wait_till_clickable(".next-btn").click()
 
 	# Org slide
@@ -55,8 +56,10 @@
 	time.sleep(1)
 
 	frappe.db.set_default('in_selenium', None)
+	frappe.db.set_value("Company", "For Testing", "write_off_account", "Write Off - FT")
+	frappe.db.set_value("Company", "For Testing", "exchange_gain_loss_account", "Exchange Gain/Loss - FT")
 	frappe.db.commit()
 
 	driver.close()
 
-	return True
\ No newline at end of file
+	return True
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 6b503b3..3164306 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -4,7 +4,6 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils.nestedset import get_root_of
 
 def boot_session(bootinfo):
 	"""boot session - send website info if guest"""
@@ -17,9 +16,9 @@
 
 		load_country_and_currency(bootinfo)
 		bootinfo.sysdefaults.territory = frappe.db.get_single_value('Selling Settings',
-			'territory') or get_root_of('Territory')
+			'territory')
 		bootinfo.sysdefaults.customer_group = frappe.db.get_single_value('Selling Settings',
-			'customer_group') or get_root_of('Customer Group')
+			'customer_group')
 
 		bootinfo.notification_settings = frappe.get_doc("Notification Control",
 			"Notification Control")
diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py
index b32f41e..eb06f27 100644
--- a/erpnext/startup/notifications.py
+++ b/erpnext/startup/notifications.py
@@ -55,7 +55,13 @@
 			},
 			"Production Order": { "status": ("in", ("Draft", "Not Started", "In Process")) },
 			"BOM": {"docstatus": 0},
-			"Timesheet": {"status": "Draft"}
+
+			"Timesheet": {"status": "Draft"},
+
+			"Lab Test": {"docstatus": 0},
+			"Sample Collection": {"docstatus": 0},
+			"Patient Appointment": {"status": "Open"},
+			"Consultation": {"docstatus": 0}
 		},
 
 		"targets": {
diff --git a/erpnext/startup/report_data_map.py b/erpnext/startup/report_data_map.py
index e4bbd87..3d5a674 100644
--- a/erpnext/startup/report_data_map.py
+++ b/erpnext/startup/report_data_map.py
@@ -269,7 +269,7 @@
 	},
 	"Purchase Receipt": {
 		"columns": ["name", "supplier", "posting_date", "company"],
-		"conditions": ["docstatus=1"], 
+		"conditions": ["docstatus=1"],
 		"order_by": "posting_date",
 		"links": {
 			"supplier": ["Supplier", "name"],
@@ -278,7 +278,7 @@
 	},
 	"Purchase Receipt Item[Purchase Analytics]": {
 		"columns": ["name", "parent", "item_code", "stock_qty as qty", "base_net_amount"],
-		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"], 
+		"conditions": ["docstatus=1", "ifnull(parent, '')!=''"],
 		"order_by": "parent",
 		"links": {
 			"parent": ["Purchase Receipt", "name"],
@@ -297,5 +297,39 @@
 		"columns": ["name","status","creation","planned_start_date","planned_end_date","status","actual_start_date","actual_end_date", "modified"],
 		"conditions": ["docstatus = 1"],
 		"order_by": "creation"
+	},
+
+	#Medical
+	"Patient": {
+		"columns": ["name", "creation", "owner", "if(patient_name=name, '', patient_name) as patient_name"],
+		"conditions": ["docstatus < 2"],
+		"order_by": "name",
+		"links": {
+			"owner" : ["User", "name"]
+		}
+	},
+	"Patient Appointment": {
+		"columns": ["name", "appointment_type", "patient", "physician", "appointment_date", "department", "status", "company"],
+		"order_by": "name",
+		"links": {
+			"physician": ["Physician", "name"],
+			"appointment_type": ["Appointment Type", "name"]
+		}
+	},
+	"Physician": {
+		"columns": ["name", "department"],
+		"order_by": "name",
+		"links": {
+			"department": ["Department", "name"],
+		}
+
+	},
+	"Appointment Type": {
+		"columns": ["name"],
+		"order_by": "name"
+	},
+	"Medical Department": {
+		"columns": ["name"],
+		"order_by": "name"
 	}
 }
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 980f79b..cb4275d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -2115,6 +2115,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2243,6 +2274,37 @@
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
    "columns": 0, 
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 1af0807..7837f8c 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -63,8 +63,8 @@
 			frm.page.set_inner_btn_group_as_primary(__("Make"));
 		}
 		if (frm.doc.variant_of) {
-			frm.set_intro(__("This Item is a Variant of {0} (Template).", 
-				[frm.doc.variant_of]), true);
+			frm.set_intro(__('This Item is a Variant of {0} (Template).', 
+				[`<a href="#Form/Item/${frm.doc.variant_of}">${frm.doc.variant_of}</a>`]), true);
 		}
 
 		if (frappe.defaults.get_default("item_naming_by")!="Naming Series" || frm.doc.variant_of) {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 7140dbd..3acdeee 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -1945,6 +1945,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "base_rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment (Company Currency)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -2070,6 +2101,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "rounding_adjustment", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Rounding Adjustment", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "in_words", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -3060,7 +3122,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-08-06 19:33:59.822251", 
+ "modified": "2017-08-29 11:02:24.831340", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index fbadbc5..fc45f13 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -631,7 +631,8 @@
 			fetch_exploded = self.use_multi_level_bom)
 
 		for item in item_dict.values():
-			item.from_warehouse = self.from_warehouse or item.default_warehouse
+			# if source warehouse presents in BOM set from_warehouse as bom source_warehouse
+			item.from_warehouse = self.from_warehouse or item.source_warehouse or item.default_warehouse
 		return item_dict
 
 	def get_bom_scrap_material(self, qty):
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js
index b0eae73..d4d1a0a 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.js
@@ -6,21 +6,21 @@
 	frappe.run_serially([
 		() => frappe.set_route('List', 'Stock Reconciliation'),
 		() => frappe.click_button('New'),
-		() => cur_frm.set_value('company','Razer Blade'),
+		() => cur_frm.set_value('company','For Testing'),
 		() => frappe.click_button('Items'),
-		() => {cur_dialog.set_value('warehouse','Stores - RB'); },
+		() => {cur_dialog.set_value('warehouse','Stores - FT'); },
 		() => frappe.timeout(0.5),
 		() => frappe.click_button('Update'),
 		() => {
 			cur_frm.doc.items[0].qty = 150;
 			cur_frm.refresh_fields('items');},
 		() => frappe.timeout(0.5),
-		() => cur_frm.set_value('expense_account','Stock Adjustment - RB'),
-		() => cur_frm.set_value('cost_center','Main - RB'),
+		() => cur_frm.set_value('expense_account','Stock Adjustment - FT'),
+		() => cur_frm.set_value('cost_center','Main - FT'),
 		() => cur_frm.save(),
 		() => {
 			// get_item_details
-			assert.ok(cur_frm.doc.expense_account=='Stock Adjustment - RB', "expense_account correct");
+			assert.ok(cur_frm.doc.expense_account=='Stock Adjustment - FT', "expense_account correct");
 		},
 		() => frappe.tests.click_button('Submit'),
 		() => frappe.tests.click_button('Yes'),
diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.js b/erpnext/stock/doctype/warehouse/test_warehouse.js
index f13bc58..8ea280c 100644
--- a/erpnext/stock/doctype/warehouse/test_warehouse.js
+++ b/erpnext/stock/doctype/warehouse/test_warehouse.js
@@ -10,7 +10,7 @@
 		() => frappe.tests.make(
 			"Warehouse", [
 				{warehouse_name: "Laptop Scrap Warehouse"},
-				{company: "Razer Blade"}
+				{company: "For Testing"}
 			]
 		),
 
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 8d084dc..72a83c6 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -90,7 +90,7 @@
 			item.lead_time_days)
 
 	if args.get("is_subcontracted") == "Yes":
-		out.bom = get_default_bom(args.item_code)
+		out.bom = args.get('bom') or get_default_bom(args.item_code)
 
 	get_gross_profit(out)
 
diff --git a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json
index 557847ab..ed48a0f 100644
--- a/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json
+++ b/erpnext/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.json
@@ -7,12 +7,12 @@
  "doctype": "Report", 
  "idx": 3, 
  "is_standard": "Yes", 
- "modified": "2017-07-22 09:24:30.201487", 
+ "modified": "2017-09-18 12:28:49.322622", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Ordered Items To Be Delivered", 
  "owner": "Administrator", 
- "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`customer_name` as \"Customer Name::150\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project:Link/Project:120\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.qty as \"Qty:Float:140\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float:140\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float:140\",\n `tabSales Order Item`.base_rate as \"Rate:Float:140\",\n `tabSales Order Item`.base_amount as \"Amount:Float:140\",\n ((`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0))*`tabSales Order Item`.base_rate) as \"Amount to Deliver:Float:140\",\n `tabBin`.actual_qty as \"Available Qty:Float:120\",\n `tabBin`.projected_qty as \"Projected Qty:Float:120\",\n `tabSales Order Item`.`delivery_date` as \"Item Delivery Date:Date:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order Item`.item_group as \"Item Group:Link/Item Group:120\",\n `tabSales Order Item`.warehouse as \"Warehouse:Link/Warehouse:200\"\nfrom\n `tabSales Order` JOIN `tabSales Order Item` \n LEFT JOIN `tabBin` ON (`tabBin`.item_code = `tabSales Order Item`.item_code\n and `tabBin`.warehouse = `tabSales Order Item`.warehouse)\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status not in (\"Stopped\", \"Closed\")\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc", 
+ "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`customer_name` as \"Customer Name::150\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project:Link/Project:120\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order Item`.qty as \"Qty:Float:140\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float:140\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float:140\",\n `tabSales Order Item`.base_rate as \"Rate:Float:140\",\n `tabSales Order Item`.base_amount as \"Amount:Float:140\",\n ((`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0))*`tabSales Order Item`.base_rate) as \"Amount to Deliver:Float:140\",\n `tabBin`.actual_qty as \"Available Qty:Float:120\",\n `tabBin`.projected_qty as \"Projected Qty:Float:120\",\n `tabSales Order Item`.`delivery_date` as \"Item Delivery Date:Date:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.item_group as \"Item Group:Link/Item Group:120\",\n `tabSales Order Item`.warehouse as \"Warehouse:Link/Warehouse:200\"\nfrom\n `tabSales Order` JOIN `tabSales Order Item` \n LEFT JOIN `tabBin` ON (`tabBin`.item_code = `tabSales Order Item`.item_code\n and `tabBin`.warehouse = `tabSales Order Item`.warehouse)\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status not in (\"Stopped\", \"Closed\")\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc", 
  "ref_doctype": "Delivery Note", 
  "report_name": "Ordered Items To Be Delivered", 
  "report_type": "Query Report", 
diff --git a/erpnext/subscription/doctype/subscription/subscription.js b/erpnext/subscription/doctype/subscription/subscription.js
deleted file mode 100644
index 75e1473..0000000
--- a/erpnext/subscription/doctype/subscription/subscription.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.ui.form.on('Subscription', {
-	setup: function(frm) {
-		frm.fields_dict['reference_document'].get_query = function() {
-			return {
-				filters: {
-					"docstatus": 1
-				}
-			};
-		};
-
-		frm.fields_dict['print_format'].get_query = function() {
-			return {
-				filters: {
-					"doc_type": frm.doc.reference_doctype
-				}
-			};
-		};
-	},
-
-	refresh: function(frm) {
-		if(frm.doc.docstatus == 1) {
-			let label = __('View {0}', [frm.doc.reference_doctype]);
-			frm.add_custom_button(__(label),
-				function() {
-					frappe.route_options = {
-						"subscription": frm.doc.name,
-					};
-					frappe.set_route("List", frm.doc.reference_doctype);
-				}
-			);
-		}
-	}
-});
\ No newline at end of file
diff --git a/erpnext/subscription/doctype/subscription/subscription_list.js b/erpnext/subscription/doctype/subscription/subscription_list.js
deleted file mode 100644
index 6a33638..0000000
--- a/erpnext/subscription/doctype/subscription/subscription_list.js
+++ /dev/null
@@ -1,12 +0,0 @@
-frappe.listview_settings['Subscription'] = {
-	add_fields: ["next_schedule_date"],
-	get_indicator: function(doc) {
-		if(doc.next_schedule_date >= frappe.datetime.get_today() ) {
-			return [__("Active"), "green"];
-		} else if(doc.docstatus === 0) {
-			return [__("Draft"), "red", "docstatus,=,0"];
-		} else {
-			return [__("Expired"), "darkgrey"];
-		}
-	}
-};
\ No newline at end of file
diff --git a/erpnext/templates/emails/recurring_document_failed.html b/erpnext/templates/emails/recurring_document_failed.html
index 9b88731..ea48034 100644
--- a/erpnext/templates/emails/recurring_document_failed.html
+++ b/erpnext/templates/emails/recurring_document_failed.html
@@ -1,12 +1,11 @@
-<h2>Recurring {{ type }} Failed</h2>
+<h2>{{_("Recurring")}} {{ type }} {{ _("Failed")}}</h2>
 
 <p>An error occured while creating recurring {{ type }} <b>{{ name }}</b> for <b>{{ party }}</b>.</p>
 <p>This could be because of some invalid Email Addresses in the {{ type }}.</p>
-<p>To stop sending repetitive error notifications from the system, we have unchecked
-"Convert into Recurring" field in the {{ type }} {{ name }}.</p>
-<p><b>Please correct the {{ type }} and make the {{ type }} recurring again.</b></p>
+<p>To stop sending repetitive error notifications from the system, we have checked "Disabled" field in the subscription {{ subscription}} for the {{ type }} {{ name }}.</p>
+<p><b>Please correct the {{ type }} and unchcked "Disabled" in the {{ subscription }} for making recurring again.</b></p>
 <hr>
 <p><b>It is necessary to take this action today itself for the above mentioned recurring {{ type }}
 to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field
-of this {{ type }} for generating the recurring {{ type }}.</b></p>
+of this {{ type }} for generating the recurring {{ type }} in the subscription {{ subscription }}.</b></p>
 <p>[This email is autogenerated]</p>
diff --git a/erpnext/templates/includes/healthcare/appointment_row_template.html b/erpnext/templates/includes/healthcare/appointment_row_template.html
new file mode 100644
index 0000000..53be5e6
--- /dev/null
+++ b/erpnext/templates/includes/healthcare/appointment_row_template.html
@@ -0,0 +1,23 @@
+<div class="web-list-item transaction-list-item">
+  <a href="/patient-appointments?name={{ doc.name }}">
+    <div class="row">
+        <div class="col-xs-3">
+            <span class="indicator {{ "green" if doc.status=="Open" else "red"}}">
+                {{ doc.name }}
+            </span>
+        </div>
+        <div class="col-xs-3">
+          {{ doc.physician }}
+        </div>
+        <div class="col-xs-2">
+          {% if doc.department %}{{ doc.department }}{% endif %}
+        </div>
+        <div class="col-xs-2 text-right small text-muted">
+          {{ doc.appointment_time }}
+        </div>
+        <div class="col-xs-2 text-right small text-muted">
+          {{ frappe.format_date(doc.appointment_date) }}
+        </div>
+    </div>
+  </a>
+</div>
diff --git a/erpnext/templates/includes/healthcare/lab_test_row_template.html b/erpnext/templates/includes/healthcare/lab_test_row_template.html
new file mode 100644
index 0000000..d6c9b54
--- /dev/null
+++ b/erpnext/templates/includes/healthcare/lab_test_row_template.html
@@ -0,0 +1,20 @@
+<div class="web-list-item transaction-list-item">
+  <a href="/lab-test?name={{ doc.name }}">
+    <div class="row">
+        <div class="col-xs-3">
+            <span class="indicator {{ "green" if doc.status=="Completed" else "red"}}">
+                {{ doc.name }}
+            </span>
+        </div>
+        <div class="col-xs-3">
+          {{ doc.test_name }}
+        </div>
+        <div class="col-xs-3">
+          {{ doc.physician }}
+        </div>
+        <div class="col-xs-3 text-right small text-muted">
+          {{ frappe.format_date(doc.result_date) }}
+        </div>
+    </div>
+  </a>
+</div>
diff --git a/erpnext/templates/includes/healthcare/prescription_row_template.html b/erpnext/templates/includes/healthcare/prescription_row_template.html
new file mode 100644
index 0000000..13ce3bc
--- /dev/null
+++ b/erpnext/templates/includes/healthcare/prescription_row_template.html
@@ -0,0 +1,15 @@
+<div class="web-list-item transaction-list-item">
+  <a href="/prescription?name={{ doc.name }}">
+    <div class="row">
+        <div class="col-xs-4">
+            {{ doc.name }}
+        </div>
+        <div class="col-xs-4">
+          {{ doc.physician }}
+        </div>
+        <div class="col-xs-4 text-right small text-muted">
+          {{ frappe.format_date(doc.consultation_date) }}
+        </div>
+    </div>
+  </a>
+</div>
diff --git a/erpnext/templates/print_formats/includes/taxes.html b/erpnext/templates/print_formats/includes/taxes.html
index b782763..41f216e 100644
--- a/erpnext/templates/print_formats/includes/taxes.html
+++ b/erpnext/templates/print_formats/includes/taxes.html
@@ -1,7 +1,7 @@
 {%- macro render_discount_amount(doc) -%}
 	{%- if doc.discount_amount -%}
 		<div class="row">
-			<div class="col-xs-5 {%- if not doc._align_labels_left %} text-right{%- endif -%}">
+			<div class="col-xs-5 {%- if doc._align_labels_right %} text-right{%- endif -%}">
 				<label>{{ _("Discount Amount") }}</label></div>
 			<div class="col-xs-7 text-right">
 				- {{ doc.get_formatted("discount_amount", doc) }}
@@ -17,7 +17,7 @@
 			{{ render_discount_amount(doc) }}
 		{%- endif -%}
 		{%- for charge in data -%}
-			{%- if charge.tax_amount and not charge.included_in_print_rate -%}
+			{%- if (charge.tax_amount or doc.flags.print_taxes_with_zero_amount) and not charge.included_in_print_rate -%}
 			<div class="row">
 				<div class="col-xs-5 {%- if doc._align_labels_right %} text-right{%- endif -%}">
 					<label>{{ charge.get_formatted("description") }}</label></div>
diff --git a/erpnext/tests/ui/make_fixtures.js b/erpnext/tests/ui/make_fixtures.js
index f817c65..0bd7491 100644
--- a/erpnext/tests/ui/make_fixtures.js
+++ b/erpnext/tests/ui/make_fixtures.js
@@ -38,6 +38,7 @@
 			{is_stock_item: 1},
 			{standard_rate: 250},
 			{opening_stock: 100},
+			{stock_uom:'Kg'}
 		],
 		"Test Service 1": [
 			{item_code: "Test Service 1"},
diff --git a/erpnext/utilities/page/leaderboard/leaderboard.html b/erpnext/utilities/page/leaderboard/leaderboard.html
deleted file mode 100644
index 8df2247..0000000
--- a/erpnext/utilities/page/leaderboard/leaderboard.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<div class="frappe-list-area">
-	<div class="frappe-list">
-		<div class="list-filters">
-			<div class="list-filter-item">
-				<select class="form-control select-doctype">
-					{% for (var i=0; i < doctypes.length; i++) { %}
-						<option value="{{doctypes[i]}}">{{ doctypes[i] }}</option>
-					{% } %}
-				</select>
-			</div>
-
-			<div class="list-filter-item">
-				<select class="form-control select-time">
-					{% for (var i=0; i < timelines.length; i++) { %}
-						<option value="{{timelines[i]}}">{{ timelines[i] }}</option>
-					{% } %}
-				</select>
-			</div>
-		</div>
-		<div class="leaderboard">
-		</div>
-	</div>
-</div>
\ No newline at end of file
diff --git a/erpnext/utilities/page/leaderboard/leaderboard.js b/erpnext/utilities/page/leaderboard/leaderboard.js
index eed9bd1..0d16ab0 100644
--- a/erpnext/utilities/page/leaderboard/leaderboard.js
+++ b/erpnext/utilities/page/leaderboard/leaderboard.js
@@ -1,114 +1,166 @@
+frappe.pages["leaderboard"].on_page_load = function (wrapper) {
+	frappe.leaderboard = new frappe.Leaderboard(wrapper);
+}
 
 frappe.Leaderboard = Class.extend({
 
 	init: function (parent) {
-		this.page = frappe.ui.make_app_page({
+		frappe.ui.make_app_page({
 			parent: parent,
 			title: "Leaderboard",
-			single_column: true
+			single_column: false
 		});
 
+		this.parent = parent;
+		this.page = this.parent.page;
+		this.page.sidebar.html(`<ul class="module-sidebar-nav overlay-sidebar nav nav-pills nav-stacked"></ul>`);
+		this.$sidebar_list = this.page.sidebar.find('ul');
+
 		// const list of doctypes
 		this.doctypes = ["Customer", "Item", "Supplier", "Sales Partner"];
-		this.timelines = ["Week", "Month", "Quarter", "Year"];
+		this.timespans = ["Week", "Month", "Quarter", "Year"];
 		this.desc_fields = ["total_amount", "total_request", "annual_billing", "commission_rate"];
 		this.filters = {
-			"Customer": this.map_array(["title", "total_amount", "total_item_purchased", "modified"]),
-			"Item": this.map_array(["title", "total_request", "total_purchase", "avg_price", "modified"]),
-			"Supplier": this.map_array(["title", "annual_billing", "total_unpaid", "modified"]),
-			"Sales Partner": this.map_array(["title", "commission_rate", "target_qty", "target_amount", "modified"]),
+			"Customer": ["total_amount", "total_item_purchased"],
+			"Item": ["total_request", "total_purchase", "avg_price"],
+			"Supplier": ["annual_billing", "total_unpaid"],
+			"Sales Partner": ["commission_rate", "target_qty", "target_amount"],
 		};
 
 		// for saving current selected filters
-		const _selected_filter = this.filters[this.doctypes[0]];
+		// TODO: revert to 0 index for doctype and timespan, and remove preset down
+		const _initial_doctype = this.doctypes[0];
+		const _initial_timespan = this.timespans[0];
+		const _initial_filter = this.filters[_initial_doctype];
+
 		this.options = {
-			selected_doctype: this.doctypes[0],
-			selected_filter: _selected_filter,
-			selected_filter_item: _selected_filter[1],
-			selected_timeline: this.timelines[0],
+			selected_doctype: _initial_doctype,
+			selected_filter: _initial_filter,
+			selected_filter_item: _initial_filter[0],
+			selected_timespan: _initial_timespan,
 		};
 
 		this.message = null;
 		this.make();
 	},
 
-
-
 	make: function () {
 		var me = this;
 
-		var $leaderboard = $(frappe.render_template("leaderboard", this)).appendTo(this.page.main);
+		var $container = $(`<div class="leaderboard page-main-content">
+			<div class="leaderboard-graph"></div>
+			<div class="leaderboard-list"></div>
+		</div>`).appendTo(this.page.main);
 
-		// events
-		$leaderboard.find(".select-doctype")
-			.on("change", function () {
-				me.options.selected_doctype = this.value;
-				me.options.selected_filter = me.filters[this.value];
-				me.options.selected_filter_item = me.filters[this.value][1];
-				me.make_request($leaderboard);
-			});
+		this.$graph_area = $container.find('.leaderboard-graph');
 
-		$leaderboard.find(".select-time")
-			.on("change", function () {
-				me.options.selected_timeline = this.value;
-				me.make_request($leaderboard);
-			});
+		this.doctypes.map(doctype => {
+			this.get_sidebar_item(doctype).appendTo(this.$sidebar_list);
+		});
+
+		this.timespan_select = this.page.add_select(__("Timespan"),
+			this.timespans.map(d => {
+				return {"label": __(d), value: d }
+			})
+		);
+
+		// this.timespan_select.val(this.timespans[1]);
+
+		this.type_select = this.page.add_select(__("Type"),
+			me.options.selected_filter.map(d => {
+				return {"label": __(frappe.model.unscrub(d)), value: d }
+			})
+		);
+
+		this.$sidebar_list.on('click', 'li', function(e) {
+			let $li = $(this);
+			let doctype = $li.find('span').html();
+
+			me.options.selected_doctype = doctype;
+			me.options.selected_filter = me.filters[doctype];
+			me.options.selected_filter_item = me.filters[doctype][0];
+
+			me.type_select.empty().add_options(
+				me.options.selected_filter.map(d => {
+					return {"label": __(frappe.model.unscrub(d)), value: d }
+				})
+			);
+
+			me.$sidebar_list.find('li').removeClass('active');
+			$li.addClass('active');
+
+			me.make_request($container);
+		});
+
+		this.timespan_select.on("change", function() {
+			me.options.selected_timespan = this.value;
+			me.make_request($container);
+		});
+
+		this.type_select.on("change", function() {
+			me.options.selected_filter_item = this.value
+			me.make_request($container);
+		});
 
 		// now get leaderboard
-		me.make_request($leaderboard);
+		this.$sidebar_list.find('li:first').trigger('click');
 	},
 
-	make_request: function ($leaderboard) {
+	make_request: function ($container) {
 		var me = this;
 
 		frappe.model.with_doctype(me.options.selected_doctype, function () {
-			me.get_leaderboard(me.get_leaderboard_data, $leaderboard);
+			me.get_leaderboard(me.get_leaderboard_data, $container);
 		});
 	},
 
-	get_leaderboard: function (notify, $leaderboard) {
+	get_leaderboard: function (notify, $container, start=0) {
 		var me = this;
 
 		frappe.call({
 			method: "erpnext.utilities.page.leaderboard.leaderboard.get_leaderboard",
 			args: {
-				obj: JSON.stringify(me.options)
+				doctype: me.options.selected_doctype,
+				timespan: me.options.selected_timespan,
+				field: me.options.selected_filter_item,
+				start: start
 			},
-			callback: function (res) {
-				console.log(res)
-				notify(me, res, $leaderboard);
+			callback: function (r) {
+				let results = r.message || [];
+
+				let graph_items = results.slice(0, 10);
+
+				me.$graph_area.show().empty();
+				let args = {
+					parent: me.$graph_area,
+					y: [
+						{
+							color: 'light-green',
+							values: graph_items.map(d=>d.value),
+							formatted: graph_items.map(d=>d[me.options.selected_filter_item])
+						}
+					],
+					x: {
+						values: graph_items.map(d=>d.name)
+					},
+					mode: 'bar',
+					height: 140
+				};
+				new frappe.ui.Graph(args);
+
+				notify(me, r, $container);
 			}
 		});
 	},
 
-	get_leaderboard_data: function (me, res, $leaderboard) {
+	get_leaderboard_data: function (me, res, $container) {
 		if (res && res.message) {
 			me.message = null;
-			$leaderboard.find(".leaderboard").html(me.render_list_view(res.message));
-
-			// event to change arrow
-			$leaderboard.find(".leaderboard-item")
-				.click(function () {
-					const field = this.innerText.trim().toLowerCase().replace(new RegExp(" ", "g"), "_");
-					if (field && field !== "title") {
-						const _selected_filter_item = me.options.selected_filter
-							.filter(i => i.field === field);
-						if (_selected_filter_item.length > 0) {
-							me.options.selected_filter_item = _selected_filter_item[0];
-							me.options.selected_filter_item.value = _selected_filter_item[0].value === "ASC" ? "DESC" : "ASC";
-
-							const new_class_name = `icon-${me.options.selected_filter_item.field} fa fa-chevron-${me.options.selected_filter_item.value === "ASC" ? "up" : "down"}`;
-							$leaderboard.find(`.icon-${me.options.selected_filter_item.field}`)
-								.attr("class", new_class_name);
-
-							// now make request to web
-							me.make_request($leaderboard);
-						}
-					}
-				});
+			$container.find(".leaderboard-list").html(me.render_list_view(res.message));
 		} else {
+			me.$graph_area.hide();
 			me.message = "No items found.";
-			$leaderboard.find(".leaderboard").html(me.render_list_view());
+			$container.find(".leaderboard-list").html(me.render_list_view());
 		}
 	},
 
@@ -129,7 +181,7 @@
 
 		var html =
 			`${me.render_list_header()}
-			 ${me.render_list_result(items)}`;
+			${me.render_list_result(items)}`;
 
 		return html;
 	},
@@ -137,23 +189,21 @@
 	render_list_header: function () {
 		var me = this;
 		const _selected_filter = me.options.selected_filter
-			.map(i => me.map_field(i.field)).slice(1);
+			.map(i => frappe.model.unscrub(i));
+		const fields = ['name', me.options.selected_filter_item];
 
 		const html =
 			`<div class="list-headers">
 				<div class="list-item list-item--head" data-list-renderer="${"List"}">
 					${
-					me.options.selected_filter
-						.map(filter => {
-							const col = me.map_field(filter.field);
+					fields.map(filter => {
+							const col = frappe.model.unscrub(filter);
 							return (
 								`<div class="leaderboard-item list-item_content ellipsis text-muted list-item__content--flex-2
-									header-btn-base ${(col !== "Title" && col !== "Modified") ? "hidden-xs" : ""}
+									header-btn-base
 									${(col && _selected_filter.indexOf(col) !== -1) ? "text-right" : ""}">
 									<span class="list-col-title ellipsis">
 										${col}
-										<i class="${"icon-" + filter.field} fa ${filter.value === "ASC" ? "fa-chevron-up" : "fa-chevron-down"}"
-											style="${col === "Title" ? "display:none;" : ""}"></i>
 									</span>
 								</div>`);
 						}).join("")
@@ -166,9 +216,18 @@
 	render_list_result: function (items) {
 		var me = this;
 
-		let _html = items.map((item) => {
+		let _html = items.map((item, index) => {
 			const $value = $(me.get_item_html(item));
-			const $item_container = $(`<div class="list-item-container">`).append($value);
+
+			let item_class = "";
+			if(index == 0) {
+				item_class = "first";
+			} else if (index == 1) {
+				item_class = "second";
+			} else if(index == 2) {
+				item_class = "third";
+			}
+			const $item_container = $(`<div class="list-item-container  ${item_class}">`).append($value);
 			return $item_container[0].outerHTML;
 		}).join("");
 
@@ -186,10 +245,10 @@
 		var me = this;
 
 		let html =
-			`<div class="no-result text-center" style="${me.message ? "" : "display:none;"}">   
+			`<div class="no-result text-center" style="${me.message ? "" : "display:none;"}">
 				<div class="msg-box no-border">
 					<p>No Item found</p>
-				</div>  
+				</div>
 			</div>`;
 
 		return html;
@@ -198,25 +257,25 @@
 	get_item_html: function (item) {
 		var me = this;
 		const _selected_filter = me.options.selected_filter
-			.map(i => me.map_field(i.field)).slice(1);
+			.map(i => frappe.model.unscrub(i));
+		const fields = ['name', me.options.selected_filter_item];
 
 		const html =
 			`<div class="list-item">
 				${
-			me.options.selected_filter
-				.map(filter => {
-					const col = me.map_field(filter.field);
-					let val = item[filter.field];
+			fields.map(filter => {
+					const col = frappe.model.unscrub(filter);
+					let val = item[filter];
 					if (col === "Modified") {
 						val = comment_when(val);
 					}
 					return (
 						`<div class="list-item_content ellipsis list-item__content--flex-2
-							${(col !== "Title" && col !== "Modified") ? "hidden-xs" : ""}
+							${(col !== "Name" && col !== "Modified") ? "hidden-xs" : ""}
 							${(col && _selected_filter.indexOf(col) !== -1) ? "text-right" : ""}">
 							${
-								col === "Title"	
-									? `<a class="grey list-id ellipsis" href="${item["href"]}"> ${val} </a>` 
+								col === "Name"
+									? `<a class="grey list-id ellipsis" href="${item["href"]}"> ${val} </a>`
 									: `<span class="text-muted ellipsis"> ${val}</span>`
 							}
 						</div>`);
@@ -227,22 +286,10 @@
 		return html;
 	},
 
-	map_field: function (field) {
-		return field.replace(new RegExp("_", "g"), " ").replace(/(^|\s)[a-z]/g, f => f.toUpperCase())
-	},
-
-	map_array: function (_array) {
-		var me = this;
-		return _array.map((str) => {
-			let value = me.desc_fields.indexOf(str) > -1 ? "DESC" : "ASC";
-			return {
-				field: str,
-				value: value
-			};
-		});
+	get_sidebar_item: function(item) {
+		return $(`<li class="strong module-sidebar-item">
+			<a class="module-link">
+			<span>${ item }</span></a>
+		</li>`);
 	}
 });
-
-frappe.pages["leaderboard"].on_page_load = function (wrapper) {
-	frappe.leaderboard = new frappe.Leaderboard(wrapper);
-}
diff --git a/erpnext/utilities/page/leaderboard/leaderboard.json b/erpnext/utilities/page/leaderboard/leaderboard.json
index 8cba765..8ccef7d 100644
--- a/erpnext/utilities/page/leaderboard/leaderboard.json
+++ b/erpnext/utilities/page/leaderboard/leaderboard.json
@@ -4,7 +4,7 @@
  "docstatus": 0, 
  "doctype": "Page", 
  "idx": 0, 
- "modified": "2017-06-06 02:54:27.504048", 
+ "modified": "2017-09-12 14:05:26.422064", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "leaderboard", 
@@ -15,5 +15,5 @@
  "standard": "Yes", 
  "style": null, 
  "system_page": 0, 
- "title": "LeaderBoard"
+ "title": "Leaderboard"
 }
\ No newline at end of file
diff --git a/erpnext/utilities/page/leaderboard/leaderboard.py b/erpnext/utilities/page/leaderboard/leaderboard.py
index 0a75410..50e8abf 100644
--- a/erpnext/utilities/page/leaderboard/leaderboard.py
+++ b/erpnext/utilities/page/leaderboard/leaderboard.py
@@ -5,69 +5,156 @@
 import frappe
 import json
 from operator import itemgetter
-from frappe.utils import add_to_date
+from frappe.utils import add_to_date, fmt_money
 from erpnext.accounts.party import get_dashboard_info
 from erpnext.accounts.utils import get_currency_precision
 
 @frappe.whitelist()
-def get_leaderboard(obj):
+def get_leaderboard(doctype, timespan, field, start=0):
 	"""return top 10 items for that doctype based on conditions"""
-	obj = frappe._dict(json.loads(obj))
 
-	doctype = obj.selected_doctype
-	timeline = obj.selected_timeline
-	filters = {"modified":(">=", get_date_from_string(timeline))}
+	print('doctype', doctype, timespan, field, start)
+
+	filters = {"modified":(">=", get_date_from_string(timespan))}
 	items = []
 	if doctype == "Customer":
-		items = get_all_customers(doctype, filters, [])
+		items = get_all_customers(doctype, filters, [], field)
 	elif  doctype == "Item":
-		items = get_all_items(doctype, filters, [])
+		items = get_all_items(doctype, filters, [], field)
 	elif  doctype == "Supplier":
-		items = get_all_suppliers(doctype, filters, [])
+		items = get_all_suppliers(doctype, filters, [], field)
 	elif  doctype == "Sales Partner":
-		items = get_all_sales_partner(doctype, filters, [])
-	
+		items = get_all_sales_partner(doctype, filters, [], field)
+
 	if len(items) > 0:
-		return filter_leaderboard_items(obj, items)
+		return items
 	return []
 
+def get_all_customers(doctype, filters, items, field, start=0, limit=20):
+	"""return all customers"""
 
-# filters start
-def filter_leaderboard_items(obj, items):
-	"""return items based on seleted filters"""
-	
-	reverse = False if obj.selected_filter_item and obj.selected_filter_item["value"] == "ASC" else True
-	# key : (x[field1], x[field2]) while sorting on 2 values
-	filtered_list = []
-	selected_field = obj.selected_filter_item and obj.selected_filter_item["field"]
-	if selected_field:
-		filtered_list  = sorted(items, key=itemgetter(selected_field), reverse=reverse)
-		value = items[0].get(selected_field)
+	x = frappe.get_list(doctype, filters=filters, limit_start=start, limit_page_length=limit)
 
-		allowed = isinstance(value, unicode) or isinstance(value, str)
-		# now sort by length
-		if allowed and '$' in value:
-			filtered_list.sort(key= lambda x: len(x[selected_field]), reverse=reverse)
-	
-	# return only 10 items'
-	return filtered_list[:10]
+	for val in x:
+		y = dict(frappe.db.sql('''select name, grand_total from `tabSales Invoice` where customer = %s''', (val.name)))
+		invoice_list = y.keys()
+		if len(invoice_list) > 0:
+			item_count = frappe.db.sql('''select count(name) from `tabSales Invoice Item` where parent in (%s)''' % ", ".join(
+				['%s'] * len(invoice_list)), tuple(invoice_list))
 
-# filters end
+			value = 0
+			if(field=="total_amount"):
+				value = sum(y.values())
+			elif(field=="total_item_purchased"):
+				value = sum(destructure_tuple_of_tuples(item_count))
+
+			item_obj = {"name": val.name,
+				"total_amount": get_formatted_value(sum(y.values())),
+				"total_item_purchased": sum(destructure_tuple_of_tuples(item_count)),
+				"href":"#Form/Customer/" + val.name,
+				"value": value}
+			items.append(item_obj)
+
+	items.sort(key=lambda k: k['value'], reverse=True)
+	return items
+
+def get_all_items(doctype, filters, items, field, start=0, limit=20):
+	"""return all items"""
+
+	x = frappe.get_list(doctype, filters=filters, limit_start=start, limit_page_length=limit)
+	for val in x:
+		data = frappe.db.sql('''select item_code from `tabMaterial Request Item` where item_code = %s''', (val.name), as_list=1)
+		requests = destructure_tuple_of_tuples(data)
+		data = frappe.db.sql('''select price_list_rate from `tabItem Price` where item_code = %s''', (val.name), as_list=1)
+		avg_price = get_avg(destructure_tuple_of_tuples(data))
+		data = frappe.db.sql('''select item_code from `tabPurchase Invoice Item` where item_code = %s''', (val.name), as_list=1)
+		purchases = destructure_tuple_of_tuples(data)
+
+		value = 0
+		if(field=="total_request"):
+			value = len(requests)
+		elif(field=="total_purchase"):
+			value = len(purchases)
+		elif(field=="avg_price"):
+			value=avg_price
+		item_obj = {"name": val.name,
+			"total_request":len(requests),
+			"total_purchase": len(purchases),
+			"avg_price": get_formatted_value(avg_price),
+			"href":"#Form/Item/" + val.name,
+			"value": value}
+		items.append(item_obj)
+
+	print(items)
+
+	items.sort(key=lambda k: k['value'], reverse=True)
+	return items
+
+def get_all_suppliers(doctype, filters, items, field, start=0, limit=20):
+	"""return all suppliers"""
+
+	x = frappe.get_list(doctype, filters=filters, limit_start=start, limit_page_length=limit)
+
+	for val in x:
+
+		info = get_dashboard_info(doctype, val.name)
+		value = 0
+		if(field=="annual_billing"):
+			value = info["billing_this_year"]
+		elif(field=="total_unpaid"):
+			value = abs(info["total_unpaid"])
+
+		item_obj = {"name": val.name,
+			"annual_billing":  get_formatted_value(info["billing_this_year"]),
+			"total_unpaid": get_formatted_value(abs(info["total_unpaid"])),
+			"href":"#Form/Supplier/" + val.name,
+			"value": value}
+		items.append(item_obj)
+
+	items.sort(key=lambda k: k['value'], reverse=True)
+	return items
+
+def get_all_sales_partner(doctype, filters, items, field, start=0, limit=20):
+	"""return all sales partner"""
+
+	x = frappe.get_list(doctype, fields=["name", "commission_rate", "modified"], filters=filters, limit_start=start, limit_page_length=limit)
+	for val in x:
+		y = frappe.db.sql('''select target_qty, target_amount from `tabTarget Detail` where parent = %s''', (val.name), as_dict=1)
+		target_qty = sum([f["target_qty"] for f in y])
+		target_amount = sum([f["target_amount"] for f in y])
+
+		value = 0
+		if(field=="commission_rate"):
+			value = val.commission_rate
+		elif(field=="target_qty"):
+			value = target_qty
+		elif(field=="target_amount"):
+			value = target_qty
+
+		item_obj = {"name": val.name,
+			"commission_rate": get_formatted_value(val.commission_rate, False),
+			"target_qty": target_qty,
+			"target_amount": get_formatted_value(target_qty),
+			"href":"#Form/Sales Partner/" + val.name,
+			"value": value}
+		items.append(item_obj)
+
+	items.sort(key=lambda k: k['value'], reverse=True)
+	return items
 
 
-# utils start
 def destructure_tuple_of_tuples(tup_of_tup):
 	"""return tuple(tuples) as list"""
 	return [y for x in tup_of_tup for y in x]
 
-def get_date_from_string(seleted_timeline):
+def get_date_from_string(seleted_timespan):
 	"""return string for ex:this week as date:string"""
 	days = months = years = 0
-	if "month" == seleted_timeline.lower():
+	if "month" == seleted_timespan.lower():
 		months = -1
-	elif "quarter" == seleted_timeline.lower():
+	elif "quarter" == seleted_timespan.lower():
 		months = -3
-	elif "year" == seleted_timeline.lower():
+	elif "year" == seleted_timespan.lower():
 		years = -1
 	else:
 		days = -7
@@ -76,7 +163,7 @@
 
 def get_filter_list(selected_filter):
 	"""return list of keys"""
-	return map((lambda y : y["field"]), filter(lambda x : not (x["field"] == "title" or x["field"] == "modified"), selected_filter))
+	return map((lambda y : y["field"]), filter(lambda x : not (x["field"] == "name" or x["field"] == "modified"), selected_filter))
 
 def get_avg(items):
 	"""return avg of list items"""
@@ -87,96 +174,9 @@
 
 def get_formatted_value(value, add_symbol=True):
 	"""return formatted value"""
-	currency_precision = get_currency_precision() or 2
 	if not add_symbol:
-		return '{:.{pre}f}'.format(value, pre=currency_precision)
-	
-	company = frappe.db.get_default("company") or frappe.get_all("Company")[0].name
-	currency = frappe.get_doc("Company", company).default_currency or frappe.boot.sysdefaults.currency;
-	currency_symbol = frappe.db.get_value("Currency", currency, "symbol")
-	return  currency_symbol + ' ' + '{:.{pre}f}'.format(value, pre=currency_precision)
-
-# utils end
-
-
-# get data
-def get_all_customers(doctype, filters, items, start=0, limit=100):
-	"""return all customers"""
-
-	x = frappe.get_list(doctype, fields=["name", "modified"], filters=filters, limit_start=start, limit_page_length=limit)
-	
-	for val in x:
-		y = dict(frappe.db.sql('''select name, grand_total from `tabSales Invoice` where customer = %s''', (val.name)))
-		invoice_list = y.keys()
-		if len(invoice_list) > 0:
-			item_count = frappe.db.sql('''select count(name) from `tabSales Invoice Item` where parent in (%s)''' % ", ".join(
-				['%s'] * len(invoice_list)), tuple(invoice_list))
-			items.append({"title": val.name,
-				"total_amount": get_formatted_value(sum(y.values())),
-				"href":"#Form/Customer/" + val.name,
-				"total_item_purchased": sum(destructure_tuple_of_tuples(item_count)),
-				"modified": str(val.modified)})
-	if len(x) > 99:
-		start = start + 1
-		return get_all_customers(doctype, filters, items, start=start)
-	else:
-		return items
-
-def get_all_items(doctype, filters, items, start=0, limit=100):
-	"""return all items"""
-
-	x = frappe.get_list(doctype, fields=["name", "modified"], filters=filters, limit_start=start, limit_page_length=limit)
-	for val in x:
-		data = frappe.db.sql('''select item_code from `tabMaterial Request Item` where item_code = %s''', (val.name), as_list=1)
-		requests = destructure_tuple_of_tuples(data)
-		data = frappe.db.sql('''select price_list_rate from `tabItem Price` where item_code = %s''', (val.name), as_list=1)
-		avg_price = get_avg(destructure_tuple_of_tuples(data))
-		data = frappe.db.sql('''select item_code from `tabPurchase Invoice Item` where item_code = %s''', (val.name), as_list=1)
-		purchases = destructure_tuple_of_tuples(data)
-		
-		items.append({"title": val.name,
-			"total_request":len(requests),
-			"total_purchase": len(purchases), "href":"#Form/Item/" + val.name,
-			"avg_price": get_formatted_value(avg_price),
-			"modified": val.modified})
-	if len(x) > 99:
-		return get_all_items(doctype, filters, items, start=start)
-	else:
-		return items
-
-def get_all_suppliers(doctype, filters, items, start=0, limit=100):
-	"""return all suppliers"""
-
-	x = frappe.get_list(doctype, fields=["name", "modified"], filters=filters, limit_start=start, limit_page_length=limit)
-	
-	for val in x:
-		info = get_dashboard_info(doctype, val.name)
-		items.append({"title": val.name,
-		"annual_billing":  get_formatted_value(info["billing_this_year"]),
-		"total_unpaid": get_formatted_value(abs(info["total_unpaid"])),
-		"href":"#Form/Supplier/" + val.name,
-		"modified": val.modified})
-
-	if len(x) > 99:
-		return get_all_suppliers(doctype, filters, items, start=start)
-	else:
-		return items
-
-def get_all_sales_partner(doctype, filters, items, start=0, limit=100):
-	"""return all sales partner"""
-	
-	x = frappe.get_list(doctype, fields=["name", "commission_rate", "modified"], filters=filters, limit_start=start, limit_page_length=limit)
-	for val in x:
-		y = frappe.db.sql('''select target_qty, target_amount from `tabTarget Detail` where parent = %s''', (val.name), as_dict=1)
-		target_qty = sum([f["target_qty"] for f in y])
-		target_amount = sum([f["target_amount"] for f in y])
-		items.append({"title": val.name,
-			"commission_rate": get_formatted_value(val.commission_rate, False),
-			"target_qty": target_qty,
-			"target_amount": get_formatted_value(target_amount),
-			"href":"#Form/Sales Partner/" + val.name,
-			"modified": val.modified})
-	if len(x) > 99:
-		return get_all_sales_partner(doctype, filters, items, start=start)
-	else:
-		return items
\ No newline at end of file
+		return '{:.{pre}f}'.format(value, pre=(get_currency_precision() or 2))
+	currency_precision = get_currency_precision() or 2
+	company = frappe.db.get_default("company")
+	currency = frappe.get_doc("Company", company).default_currency or frappe.boot.sysdefaults.currency
+	return fmt_money(value, currency_precision, currency)
diff --git a/erpnext/utilities/page/leaderboard/leaderboard_main_head.html b/erpnext/utilities/page/leaderboard/leaderboard_main_head.html
deleted file mode 100644
index 257d4ed..0000000
--- a/erpnext/utilities/page/leaderboard/leaderboard_main_head.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<div class="list-item__content ellipsis text-muted list-item__content--flex-2
-	{% if(col !== "Title" && col !== "Modified") { %}
-		hidden-xs
-	{% } %}
-	{% if(col && selected_filter.indexOf(col) !== -1) { %}text-right{% } %}">
-	
-	<span class="list-col-title ellipsis">{{col}}</span>
-</div>
\ No newline at end of file
diff --git a/erpnext/utilities/page/leaderboard/leaderboard_row_head.html b/erpnext/utilities/page/leaderboard/leaderboard_row_head.html
deleted file mode 100644
index 5a4e1dd..0000000
--- a/erpnext/utilities/page/leaderboard/leaderboard_row_head.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="list-item list-item--head" data-list-renderer="{{__(" List ")}}">
-	{{ main }}
-</div>
\ No newline at end of file
diff --git a/erpnext/utilities/user_progress.py b/erpnext/utilities/user_progress.py
index 482179b..6a2ec4b 100644
--- a/erpnext/utilities/user_progress.py
+++ b/erpnext/utilities/user_progress.py
@@ -9,10 +9,18 @@
 	defaults = frappe.defaults.get_defaults()
 	domain = frappe.db.get_value('Company', erpnext.get_default_company(), 'domain')
 	company = defaults.get("company") or ''
+	currency = defaults.get("currency") or ''
+
+	doc = frappe.get_doc("Setup Progress")
+	item = [d for d in doc.get("actions") if d.action_name == "Set Sales Target"][0]
+	item.action_document = company
+	item.save()
+	doc.save()
+
 	# Initial state of slides
 	return [
 		frappe._dict(
-			action_name='Add Company',
+			action_name=_('Add Company'),
 			title=_("Setup Company") if domain != 'Education' else _("Setup Institution"),
 			help=_('Setup your ' + ('company' if domain != 'Education' else 'institution') + ' and brand.'),
 			# image_src="/assets/erpnext/images/illustrations/shop.jpg",
@@ -29,12 +37,29 @@
 					"video_id": "U5wPIvEn-0c"
 				}
 			]
-		)
-		,
+		),
 		frappe._dict(
-			action_name='Add Customers',
+			action_name='Set Sales Target',
 			domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
-			icon="fa fa-group",
+			title=_("Set a Target"),
+			help=_("Set a sales goal you'd like to achieve for your company."),
+			fields=[
+				{"fieldtype":"Currency", "fieldname":"monthly_sales_target",
+					"label":_("Monthly Sales Target (" + currency + ")")},
+			],
+			submit_method="erpnext.utilities.user_progress_utils.set_sales_target",
+			done_state_title=_("Go to " + company),
+			done_state_title_route=["Form", "Company", company],
+			help_links=[
+				{
+					"label": _('Learn More'),
+					"url": ["https://erpnext.org/docs/user/manual/en/setting-up/setting-company-sales-goal"]
+				}
+			]
+		),
+		frappe._dict(
+			action_name=_('Add Customers'),
+			domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
 			title=_("Add Customers"),
 			help=_("List a few of your customers. They could be organizations or individuals."),
 			fields=[
@@ -57,7 +82,7 @@
 			]
 		),
 		frappe._dict(
-			action_name='Add Suppliers',
+			action_name=_('Add Suppliers'),
 			domains=('Manufacturing', 'Services', 'Retail', 'Distribution'),
 			icon="fa fa-group",
 			title=_("Your Suppliers"),
@@ -86,7 +111,7 @@
 			]
 		),
 		frappe._dict(
-			action_name='Add Products',
+			action_name=_('Add Products'),
 			domains=['Manufacturing', 'Services', 'Retail', 'Distribution'],
 			icon="fa fa-barcode",
 			title=_("Your Products or Services"),
@@ -117,7 +142,7 @@
 
 		# School slides begin
 		frappe._dict(
-			action_name='Add Programs',
+			action_name=_('Add Programs'),
 			domains=("Education"),
 			title=_("Program"),
 			help=_("Example: Masters in Computer Science"),
@@ -138,7 +163,7 @@
 
 		),
 		frappe._dict(
-			action_name='Add Courses',
+			action_name=_('Add Courses'),
 			domains=["Education"],
 			title=_("Course"),
 			help=_("Example: Basic Mathematics"),
@@ -158,7 +183,7 @@
 			]
 		),
 		frappe._dict(
-			action_name='Add Instructors',
+			action_name=_('Add Instructors'),
 			domains=["Education"],
 			title=_("Instructor"),
 			help=_("People who teach at your organisation"),
@@ -178,7 +203,7 @@
 			]
 		),
 		frappe._dict(
-			action_name='Add Rooms',
+			action_name=_('Add Rooms'),
 			domains=["Education"],
 			title=_("Room"),
 			help=_("Classrooms/ Laboratories etc where lectures can be scheduled."),
@@ -197,7 +222,7 @@
 		# School slides end
 
 		frappe._dict(
-			action_name='Add Users',
+			action_name=_('Add Users'),
 			title=_("Add Users"),
 			help=_("Add users to your organization, other than yourself."),
 			fields=[
diff --git a/erpnext/utilities/user_progress_utils.py b/erpnext/utilities/user_progress_utils.py
index 1c9c9e8..709da57 100644
--- a/erpnext/utilities/user_progress_utils.py
+++ b/erpnext/utilities/user_progress_utils.py
@@ -9,6 +9,12 @@
 from erpnext.setup.doctype.setup_progress.setup_progress import update_domain_actions, get_domain_actions_state
 
 @frappe.whitelist()
+def set_sales_target(args_data):
+	args = json.loads(args_data)
+	defaults = frappe.defaults.get_defaults()
+	frappe.db.set_value("Company", defaults.get("company"), "monthly_sales_target", args.get('monthly_sales_target'))
+
+@frappe.whitelist()
 def create_customers(args_data):
 	args = json.loads(args_data)
 	defaults = frappe.defaults.get_defaults()