feat: show linked Sales Invoice in Patient Appointment after booking
This commit is contained in:
parent
4dd6f0ae9b
commit
ba740ff558
@ -40,8 +40,30 @@ frappe.ui.form.on('Patient Appointment', {
|
|||||||
|
|
||||||
if (frm.is_new()) {
|
if (frm.is_new()) {
|
||||||
frm.page.set_primary_action(__('Check Availability'), function() {
|
frm.page.set_primary_action(__('Check Availability'), function() {
|
||||||
|
frappe.db.get_value('Healthcare Settings', {name: 'Healthcare Settings'}, 'manage_appointment_invoice_automatically', (settings) => {
|
||||||
|
if (settings.manage_appointment_invoice_automatically) {
|
||||||
|
if (!frm.doc.mode_of_payment) {
|
||||||
|
frappe.msgprint({
|
||||||
|
title: __('Not Allowed'),
|
||||||
|
message: __('Please select a Mode of Payment first'),
|
||||||
|
indicator: 'red'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!frm.doc.paid_amount) {
|
||||||
|
frappe.msgprint({
|
||||||
|
title: __('Not Allowed'),
|
||||||
|
message: __('Please set the Paid Amount first'),
|
||||||
|
indicator: 'red'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
if (!frm.doc.patient) {
|
if (!frm.doc.patient) {
|
||||||
frappe.throw(__('Please select a patient first'));
|
frappe.msgprint({
|
||||||
|
title: __('Not Allowed'),
|
||||||
|
message: __('Please select Patient first'),
|
||||||
|
indicator: 'red'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
check_and_set_availability(frm);
|
check_and_set_availability(frm);
|
||||||
}
|
}
|
||||||
@ -301,7 +323,7 @@ let get_prescribed_procedure = function(frm) {
|
|||||||
} else {
|
} else {
|
||||||
frappe.msgprint({
|
frappe.msgprint({
|
||||||
title: __('Not Allowed'),
|
title: __('Not Allowed'),
|
||||||
message: __('Please select Patient first')
|
message: __('Please select a Patient first')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -103,6 +103,7 @@ def invoice_appointment(appointment_doc):
|
|||||||
sales_invoice.save(ignore_permissions=True)
|
sales_invoice.save(ignore_permissions=True)
|
||||||
sales_invoice.submit()
|
sales_invoice.submit()
|
||||||
frappe.msgprint(_("Sales Invoice {0} created as paid".format(sales_invoice.name)), alert=True)
|
frappe.msgprint(_("Sales Invoice {0} created as paid".format(sales_invoice.name)), alert=True)
|
||||||
|
frappe.db.set_value('Patient Appointment', appointment_doc.name, 'ref_sales_invoice', sales_invoice.name)
|
||||||
|
|
||||||
def appointment_cancel(appointment_id):
|
def appointment_cancel(appointment_id):
|
||||||
appointment = frappe.get_doc("Patient Appointment", appointment_id)
|
appointment = frappe.get_doc("Patient Appointment", appointment_id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user