Payment mode and Paid amount in Patient Appointment

This commit is contained in:
Jamsheer 2018-08-06 16:41:32 +05:30
parent 7cc205946c
commit 359bb512b4
3 changed files with 83 additions and 3 deletions

View File

@ -84,6 +84,20 @@ frappe.ui.form.on('Patient Appointment', {
}); });
} }
frm.set_df_property("get_procedure_from_encounter", "read_only", frm.doc.__islocal ? 0 : 1); frm.set_df_property("get_procedure_from_encounter", "read_only", frm.doc.__islocal ? 0 : 1);
frappe.db.get_value('Healthcare Settings', {name: 'Healthcare Settings'}, 'manage_appointment_invoice_automatically', (r) => {
if(r.manage_appointment_invoice_automatically == 1){
frm.set_df_property("mode_of_payment", "hidden", 0);
frm.set_df_property("paid_amount", "hidden", 0);
frm.set_df_property("mode_of_payment", "reqd", 1);
frm.set_df_property("paid_amount", "reqd", 1);
}
else{
frm.set_df_property("mode_of_payment", "hidden", 1);
frm.set_df_property("paid_amount", "hidden", 1);
frm.set_df_property("mode_of_payment", "reqd", 0);
frm.set_df_property("paid_amount", "reqd", 0);
}
});
}, },
check_availability: function(frm) { check_availability: function(frm) {
var { practitioner, appointment_date } = frm.doc; var { practitioner, appointment_date } = frm.doc;
@ -335,6 +349,7 @@ frappe.ui.form.on("Patient Appointment", "practitioner", function(frm) {
}, },
callback: function (data) { callback: function (data) {
frappe.model.set_value(frm.doctype,frm.docname, "department",data.message.department); frappe.model.set_value(frm.doctype,frm.docname, "department",data.message.department);
frappe.model.set_value(frm.doctype,frm.docname, "paid_amount",data.message.op_consulting_charge);
} }
}); });
} }

View File

@ -617,7 +617,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"depends_on": "eval:!doc.__islocal", "depends_on": "",
"fieldname": "section_break_1", "fieldname": "section_break_1",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -674,6 +674,71 @@
"translatable": 0, "translatable": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "mode_of_payment",
"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": "Mode of Payment",
"length": 0,
"no_copy": 0,
"options": "Mode of Payment",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "paid_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": "Paid Amount",
"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,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0, "allow_in_quick_entry": 0,

View File

@ -71,8 +71,8 @@ def invoice_appointment(appointment_doc):
item_line.reference_dn = appointment_doc.name item_line.reference_dn = appointment_doc.name
payments_line = sales_invoice.append("payments") payments_line = sales_invoice.append("payments")
payments_line.mode_of_payment = "Cash" payments_line.mode_of_payment = appointment_doc.mode_of_payment
payments_line.amount = practitioner_charge payments_line.amount = appointment_doc.paid_amount
sales_invoice.set_missing_values(for_validate = True) sales_invoice.set_missing_values(for_validate = True)