refactor: Healthcare Settings
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
index 95d9e44..5e39196 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
@@ -8,7 +8,7 @@
"field_order": [
"sb_op_settings",
"patient_master_name",
- "manage_customer",
+ "link_customer_to_patient",
"default_medical_code_standard",
"column_break_9",
"collect_registration_fee",
@@ -21,9 +21,19 @@
"op_consulting_charge_item",
"column_break_13",
"clinical_procedure_consumable_item",
+ "sb_in_ac",
+ "income_account",
+ "receivable_account",
+ "sb_lab_settings",
+ "create_lab_test_on_si_submit",
+ "create_sample_collection_for_lab_test",
+ "column_break_34",
+ "employee_name_and_designation_in_print",
+ "lab_test_approval_required",
+ "custom_signature_in_print",
"out_patient_sms_alerts",
- "reg_sms",
"reg_msg",
+ "reg_sms",
"app_con",
"app_con_msg",
"no_con",
@@ -31,17 +41,6 @@
"app_rem",
"app_rem_msg",
"rem_before",
- "sb_in_ac",
- "income_account",
- "sb_r_ac",
- "receivable_account",
- "sb_lab_settings",
- "create_test_on_si_submit",
- "require_sample_collection",
- "require_test_result_approval",
- "column_break_34",
- "employee_name_and_designation_in_print",
- "custom_signature_in_print",
"laboratory_sms_alerts",
"sms_printed",
"column_break_28",
@@ -60,13 +59,6 @@
"options": "Patient Name\nNaming Series"
},
{
- "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",
- "label": "Manage Customer"
- },
- {
"fieldname": "default_medical_code_standard",
"fieldtype": "Link",
"label": "Default Medical Code Standard",
@@ -98,20 +90,23 @@
"label": "Invoice Appointments Automatically"
},
{
+ "description": "The number of free follow ups (Patient Encounters in valid days) allowed",
"fieldname": "max_visit",
"fieldtype": "Int",
"label": "Patient Encounters in valid days"
},
{
+ "description": "Time period (Valid number of days) for free consultations",
"fieldname": "valid_days",
"fieldtype": "Int",
"label": "Valid number of days"
},
{
"collapsible": 1,
+ "description": "You can configure default Items for billing consultation charges, procedure consumption items and inpatient visits",
"fieldname": "healthcare_service_items",
"fieldtype": "Section Break",
- "label": "Healthcare Service Items"
+ "label": "Default Healthcare Service Items"
},
{
"fieldname": "inpatient_visit_charge_item",
@@ -203,25 +198,19 @@
},
{
"collapsible": 1,
- "description": "Default income accounts to be used if not set in Healthcare Practitioner to book Appointment charges.",
"fieldname": "sb_in_ac",
"fieldtype": "Section Break",
- "label": "Income Account"
+ "label": "Default Accounts"
},
{
+ "description": "Default income accounts to be used if not set in Healthcare Practitioner to book Appointment charges.",
"fieldname": "income_account",
"fieldtype": "Table",
"label": "Income Account",
"options": "Party Account"
},
{
- "collapsible": 1,
- "description": "Default receivable accounts to be used if not set in Patient to book Appointment charges.",
- "fieldname": "sb_r_ac",
- "fieldtype": "Section Break",
- "label": "Receivable Account"
- },
- {
+ "description": "Default receivable accounts to be used to book Appointment charges.",
"fieldname": "receivable_account",
"fieldtype": "Table",
"label": "Receivable Account",
@@ -234,30 +223,12 @@
"label": "Laboratory Settings"
},
{
- "default": "0",
- "fieldname": "create_test_on_si_submit",
- "fieldtype": "Check",
- "label": "Create Lab Test(s) on Sales Invoice Submit"
- },
- {
- "default": "0",
- "description": "Create documents for sample collection",
- "fieldname": "require_sample_collection",
- "fieldtype": "Check",
- "label": "Manage Sample Collection"
- },
- {
- "default": "0",
- "fieldname": "require_test_result_approval",
- "fieldtype": "Check",
- "label": "Require Lab Test Approval"
- },
- {
"fieldname": "column_break_34",
"fieldtype": "Column Break"
},
{
"default": "1",
+ "description": "Check this 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.",
"fieldname": "employee_name_and_designation_in_print",
"fieldtype": "Check",
"label": "Employee name and designation in print"
@@ -279,7 +250,7 @@
"fieldname": "sms_printed",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
- "label": "Result Printed"
+ "label": "Result Printed Message"
},
{
"fieldname": "column_break_28",
@@ -290,12 +261,40 @@
"fieldname": "sms_emailed",
"fieldtype": "Small Text",
"ignore_xss_filter": 1,
- "label": "Result Emailed"
+ "label": "Result Emailed Message"
+ },
+ {
+ "default": "0",
+ "description": "Checking this will restrict printing and emailing of Lab Test documents unless they have the status as Approved.",
+ "fieldname": "lab_test_approval_required",
+ "fieldtype": "Check",
+ "label": "Do not print or email Lab Tests without Approval"
+ },
+ {
+ "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": "link_customer_to_patient",
+ "fieldtype": "Check",
+ "label": "Link Customer to Patient"
+ },
+ {
+ "default": "0",
+ "description": "Checking this will create Lab Test(s) specified in the Sales Invoice on submission.",
+ "fieldname": "create_lab_test_on_si_submit",
+ "fieldtype": "Check",
+ "label": "Create Lab Test(s) on Sales Invoice Submission"
+ },
+ {
+ "default": "0",
+ "description": "Checking this will create a Sample Collection document every time you create a Lab Test",
+ "fieldname": "create_sample_collection_for_lab_test",
+ "fieldtype": "Check",
+ "label": "Create Sample Collection document for Lab Test"
}
],
"issingle": 1,
"links": [],
- "modified": "2020-01-23 13:31:43.699711",
+ "modified": "2020-01-28 18:04:48.671093",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare Settings",
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
index 8555e80..a36bed6 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
@@ -11,69 +11,80 @@
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"]:
+ for key in ['collect_registration_fee', 'link_customer_to_patient', 'patient_master_name',
+ 'lab_test_approval_required', 'create_sample_collection_for_lab_test', '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"))
+
+ if self.collect_registration_fee:
+ if self.registration_fee <= 0:
+ frappe.throw(_('Registration Fee cannot be negative or zero'))
+
if self.inpatient_visit_charge_item:
- validate_service_item(self.inpatient_visit_charge_item, "Configure a service Item for Inpatient Visit Charge Item")
+ validate_service_item(self.inpatient_visit_charge_item)
if self.op_consulting_charge_item:
- validate_service_item(self.op_consulting_charge_item, "Configure a service Item for Out Patient Consulting Charge Item")
+ validate_service_item(self.op_consulting_charge_item)
if self.clinical_procedure_consumable_item:
- validate_service_item(self.clinical_procedure_consumable_item, "Configure a service Item for Clinical Procedure Consumable Item")
+ validate_service_item(self.clinical_procedure_consumable_item)
+
+
+def validate_service_item(item):
+ if frappe.db.get_value('Item', item, 'is_stock_item'):
+ frappe.throw(_('Configure a service Item for {0}').format(item))
@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
+ sms_text = {}
+ doc = frappe.get_doc('Lab Test', 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)
-
+ if frappe.db.get_value('Healthcare Settings', None, 'reg_sms'):
+ 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.get_cached_value('Company', company, "default_receivable_account")
+ receivable_account = get_account(None, 'receivable_account', 'Healthcare Settings', company)
+ if receivable_account:
+ return receivable_account
+
+ return frappe.get_cached_value('Company', company, 'default_receivable_account')
def get_income_account(practitioner, company):
- if(practitioner):
- income_account = get_account("Healthcare Practitioner", None, practitioner, 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.get_cached_value('Company', company, "default_income_account")
+ # check income account in Healthcare Practitioner
+ if practitioner:
+ income_account = get_account('Healthcare Practitioner', None, practitioner, company)
+ if income_account:
+ return income_account
+
+ # else check income account in Healthcare Settings
+ income_account = get_account(None, 'income_account', 'Healthcare Settings', company)
+ if income_account:
+ return income_account
+
+ # else return default income account of company
+ return frappe.get_cached_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")
+ if parent_type:
+ return frappe.db.get_value('Party Account',
+ {'parenttype': parent_type, 'parent': parent, 'company': company}, 'account')
-def validate_service_item(item, msg):
- if frappe.db.get_value("Item", item, "is_stock_item") == 1:
- frappe.throw(_(msg))
+ if parent_field:
+ return frappe.db.get_value('Party Account',
+ {'parentfield': parent_field, 'parent': parent, 'company': company}, 'account')
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.js b/erpnext/healthcare/doctype/lab_test/lab_test.js
index b60e70f..5b3f4c7 100644
--- a/erpnext/healthcare/doctype/lab_test/lab_test.js
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.js
@@ -29,7 +29,7 @@
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")){
+ if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("lab_test_approval_required") && frappe.user.has_role("LabTest Approver")){
frm.add_custom_button(__('Approve'), function() {
status_update(1,frm);
});
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py
index 8609489..1a05f1e 100644
--- a/erpnext/healthcare/doctype/lab_test/lab_test.py
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.py
@@ -224,7 +224,7 @@
return sample_collection
def create_sample_collection(lab_test, template, patient, invoice):
- if(frappe.db.get_value("Healthcare Settings", None, "require_sample_collection") == "1"):
+ if(frappe.db.get_value("Healthcare Settings", None, "create_sample_collection_for_lab_test") == "1"):
sample_collection = create_sample_doc(template, patient, invoice)
if(sample_collection):
lab_test.sample = sample_collection.name
diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py
index e3eea96..df75c01 100644
--- a/erpnext/healthcare/doctype/patient/patient.py
+++ b/erpnext/healthcare/doctype/patient/patient.py
@@ -13,7 +13,7 @@
class Patient(Document):
def after_insert(self):
- if(frappe.db.get_value("Healthcare Settings", None, "manage_customer") == '1' and not self.customer):
+ if(frappe.db.get_value("Healthcare Settings", None, "link_customer_to_patient") == '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)
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.js b/erpnext/healthcare/doctype/sample_collection/sample_collection.js
index 9934ce4..2f5278b 100644
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.js
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.js
@@ -3,7 +3,7 @@
frappe.ui.form.on('Sample Collection', {
refresh: function(frm) {
- if(frappe.defaults.get_default("require_sample_collection")){
+ if(frappe.defaults.get_default("create_sample_collection_for_lab_test")){
frm.add_custom_button(__("View Lab Tests"), function() {
frappe.route_options = {"sample": frm.doc.name};
frappe.set_route("List", "Lab Test");
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
index 6badc6f..e8e95d8 100644
--- a/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json
+++ b/erpnext/healthcare/print_format/lab_test_print/lab_test_print.json
@@ -1,22 +1,22 @@
{
- "align_labels_right": 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\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>Practitioner</label>\n </div>\n {% if doc.practitioner %}\n <div class=\"col-xs-7 text-left value\">\n <strong>: </strong>{{doc.practitioner}}\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.lab_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 %}  {%- endif -%}\n {%- if row.lab_test_name -%}<b>{{ row.lab_test_name }}</b>\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_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 -%} \n {%- if row.lab_test_uom -%}{{ row.lab_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.lab_test_name }}</b> </td><td></td></tr>\n {%- for row in doc.special_test_items -%}\n <tr>\n <td style=\"width: 30%;border:none;\">   {{ row.lab_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": "2018-09-04 12:03:47.066918",
- "modified_by": "Administrator",
- "module": "Healthcare",
- "name": "Lab Test Print",
- "owner": "Administrator",
- "print_format_builder": 0,
- "print_format_type": "Server",
- "show_section_headings": 0,
+ "align_labels_right": 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\", \"lab_test_approval_required\") == '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\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>Practitioner</label>\n </div>\n {% if doc.practitioner %}\n <div class=\"col-xs-7 text-left value\">\n <strong>: </strong>{{doc.practitioner}}\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.lab_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 %}  {%- endif -%}\n {%- if row.lab_test_name -%}<b>{{ row.lab_test_name }}</b>\n {%- else -%}   {%- endif -%}\n {%- if row.lab_test_event -%}   {{ row.lab_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 -%} \n {%- if row.lab_test_uom -%}{{ row.lab_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.lab_test_name }}</b> </td><td></td></tr>\n {%- for row in doc.special_test_items -%}\n <tr>\n <td style=\"width: 30%;border:none;\">   {{ row.lab_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": "2018-09-04 12:03:47.066918",
+ "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"
}
\ No newline at end of file
diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py
index 97bb98f..bae0e4d 100644
--- a/erpnext/healthcare/utils.py
+++ b/erpnext/healthcare/utils.py
@@ -224,7 +224,7 @@
if frappe.get_meta(item.reference_dt).has_field("invoiced"):
set_invoiced(item, method, doc.name)
- if method=="on_submit" and frappe.db.get_value("Healthcare Settings", None, "create_test_on_si_submit") == '1':
+ if method=="on_submit" and frappe.db.get_value("Healthcare Settings", None, "create_lab_test_on_si_submit") == '1':
create_multiple("Sales Invoice", doc.name)
def set_invoiced(item, method, ref_invoice=None):