fix: code clean-up
This commit is contained in:
parent
73edb12ab3
commit
afa001a1d1
@ -34,10 +34,10 @@ frappe.ui.form.on('Lab Test', {
|
||||
if (frm.doc.docstatus === 1 && frm.doc.status !== 'Approved' && frm.doc.status !== 'Rejected') {
|
||||
frm.add_custom_button(__('Approve'), function () {
|
||||
status_update(1, frm);
|
||||
});
|
||||
}, __('Actions'));
|
||||
frm.add_custom_button(__('Reject'), function () {
|
||||
status_update(0, frm);
|
||||
});
|
||||
}, __('Actions'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ var make_dialog = function (frm, emailed, printed) {
|
||||
title: 'Send SMS',
|
||||
width: 400,
|
||||
fields: [
|
||||
{ fieldname: 'sms_type', fieldtype: 'Select', label: 'Type', options: ['Emailed', 'Printed'] },
|
||||
{ fieldname: 'result_format', fieldtype: 'Select', label: 'Result Format', options: ['Emailed', 'Printed'] },
|
||||
{ fieldname: 'number', fieldtype: 'Data', label: 'Mobile Number', reqd: 1 },
|
||||
{ fieldname: 'message', fieldtype: 'Small Text', label: 'Message', reqd: 1 }
|
||||
],
|
||||
@ -200,22 +200,22 @@ var make_dialog = function (frm, emailed, printed) {
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
if (frm.doc.report_preference == 'Print') {
|
||||
if (frm.doc.report_preference === 'Print') {
|
||||
dialog.set_values({
|
||||
'sms_type': 'Printed',
|
||||
'result_format': 'Printed',
|
||||
'number': number,
|
||||
'message': printed
|
||||
});
|
||||
} else {
|
||||
dialog.set_values({
|
||||
'sms_type': 'Emailed',
|
||||
'result_format': 'Emailed',
|
||||
'number': number,
|
||||
'message': emailed
|
||||
});
|
||||
}
|
||||
var fd = dialog.fields_dict;
|
||||
$(fd.sms_type.input).change(function () {
|
||||
if (dialog.get_value('sms_type') == 'Emailed') {
|
||||
$(fd.result_format.input).change(function () {
|
||||
if (dialog.get_value('result_format') === 'Emailed') {
|
||||
dialog.set_values({
|
||||
'number': number,
|
||||
'message': emailed
|
||||
|
@ -103,7 +103,7 @@ def create_multiple(doctype, docname):
|
||||
lab_test_created = create_lab_test_from_encounter(docname)
|
||||
|
||||
if lab_test_created:
|
||||
frappe.msgprint(_('Lab Test(s) {0} created'.format(lab_test_created)))
|
||||
frappe.msgprint(_('Lab Test(s) {0} created'.format(lab_test_created)), indicator='green')
|
||||
else:
|
||||
frappe.msgprint(_('No Lab Tests created'))
|
||||
|
||||
@ -225,8 +225,9 @@ def create_sample_doc(template, patient, invoice, company = None):
|
||||
'docstatus': 0,
|
||||
'sample': template.sample
|
||||
})
|
||||
|
||||
if sample_exists:
|
||||
# Update Sample Collection by adding quantity
|
||||
# update sample collection by adding quantity
|
||||
sample_collection = frappe.get_doc('Sample Collection', sample_exists[0][0])
|
||||
quantity = int(sample_collection.sample_qty) + int(template.sample_qty)
|
||||
if template.sample_details:
|
||||
@ -252,7 +253,7 @@ def create_sample_doc(template, patient, invoice, company = None):
|
||||
sample_collection.company = company
|
||||
|
||||
if template.sample_details:
|
||||
sample_collection.sample_details = 'Test :' + (template.get('lab_test_name') or template.get('template')) + '\n' + 'Collection Detials:\n\t' + template.sample_details
|
||||
sample_collection.sample_details = _('Test :') + (template.get('lab_test_name') or template.get('template')) + '\n' + 'Collection Detials:\n\t' + template.sample_details
|
||||
sample_collection.save(ignore_permissions=True)
|
||||
|
||||
return sample_collection
|
||||
@ -270,10 +271,13 @@ def create_sample_collection(lab_test, template, patient, invoice):
|
||||
def load_result_format(lab_test, template, prescription, invoice):
|
||||
if template.lab_test_template_type == 'Single':
|
||||
create_normals(template, lab_test)
|
||||
|
||||
elif template.lab_test_template_type == 'Compound':
|
||||
create_compounds(template, lab_test, False)
|
||||
|
||||
elif template.lab_test_template_type == 'Descriptive':
|
||||
create_descriptives(template, lab_test)
|
||||
|
||||
elif template.lab_test_template_type == 'Grouped':
|
||||
# Iterate for each template in the group and create one result for all.
|
||||
for lab_test_group in template.lab_test_groups:
|
||||
@ -283,6 +287,7 @@ def load_result_format(lab_test, template, prescription, invoice):
|
||||
if template_in_group:
|
||||
if template_in_group.lab_test_template_type == 'Single':
|
||||
create_normals(template_in_group, lab_test)
|
||||
|
||||
elif template_in_group.lab_test_template_type == 'Compound':
|
||||
normal_heading = lab_test.append('normal_test_items')
|
||||
normal_heading.lab_test_name = template_in_group.lab_test_name
|
||||
@ -290,6 +295,7 @@ def load_result_format(lab_test, template, prescription, invoice):
|
||||
normal_heading.allow_blank = 1
|
||||
normal_heading.template = template_in_group.name
|
||||
create_compounds(template_in_group, lab_test, True)
|
||||
|
||||
elif template_in_group.lab_test_template_type == 'Descriptive':
|
||||
descriptive_heading = lab_test.append('descriptive_test_items')
|
||||
descriptive_heading.lab_test_name = template_in_group.lab_test_name
|
||||
@ -297,6 +303,7 @@ def load_result_format(lab_test, template, prescription, invoice):
|
||||
descriptive_heading.allow_blank = 1
|
||||
descriptive_heading.template = template_in_group.name
|
||||
create_descriptives(template_in_group, lab_test)
|
||||
|
||||
else: # Lab Test Group - Add New Line
|
||||
normal = lab_test.append('normal_test_items')
|
||||
normal.lab_test_name = lab_test_group.group_event
|
||||
@ -307,6 +314,7 @@ def load_result_format(lab_test, template, prescription, invoice):
|
||||
normal.allow_blank = lab_test_group.allow_blank
|
||||
normal.require_result_value = 1
|
||||
normal.template = template.name
|
||||
|
||||
if template.lab_test_template_type != 'No Result':
|
||||
if prescription:
|
||||
lab_test.prescription = prescription
|
||||
|
@ -24,7 +24,7 @@ frappe.listview_settings['Lab Test'] = {
|
||||
|
||||
var create_multiple_dialog = function (listview) {
|
||||
var dialog = new frappe.ui.Dialog({
|
||||
title: 'Create Multiple Lab Test',
|
||||
title: 'Create Multiple Lab Tests',
|
||||
width: 100,
|
||||
fields: [
|
||||
{ fieldtype: 'Link', label: 'Patient', fieldname: 'patient', options: 'Patient', reqd: 1 },
|
||||
@ -44,7 +44,7 @@ var create_multiple_dialog = function (listview) {
|
||||
}
|
||||
}
|
||||
],
|
||||
primary_action_label: __('Create Lab Test'),
|
||||
primary_action_label: __('Create'),
|
||||
primary_action: function () {
|
||||
frappe.call({
|
||||
method: 'erpnext.healthcare.doctype.lab_test.lab_test.create_multiple',
|
||||
|
Loading…
x
Reference in New Issue
Block a user