-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Therapy Plan Template (#23558)
* feat: Therapy Plan Template * feat: Handle billing Therapy Plans created via Templates * feat: add dashboard to Therapy Plan Template * fix: codacy issues * fix: sider * fix: validate Therapy Session overlap * feat: Create Sales Invoice from Therapy Plan * fix: sider * chore: added tests for Therapy Plan Template * fix: test * fix: test Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com> Co-authored-by: Nabin Hait <nabinhait@gmail.com>
- Loading branch information
1 parent
e977bc3
commit 434791e
Showing
20 changed files
with
594 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
10 changes: 10 additions & 0 deletions
10
erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors | ||
# See license.txt | ||
from __future__ import unicode_literals | ||
|
||
# import frappe | ||
import unittest | ||
|
||
class TestTherapyPlanTemplate(unittest.TestCase): | ||
pass |
57 changes: 57 additions & 0 deletions
57
erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors | ||
// For license information, please see license.txt | ||
|
||
frappe.ui.form.on('Therapy Plan Template', { | ||
refresh: function(frm) { | ||
frm.set_query('therapy_type', 'therapy_types', () => { | ||
return { | ||
filters: { | ||
'is_billable': 1 | ||
} | ||
}; | ||
}); | ||
}, | ||
|
||
set_totals: function(frm) { | ||
let total_sessions = 0; | ||
let total_amount = 0.0; | ||
frm.doc.therapy_types.forEach((d) => { | ||
if (d.no_of_sessions) total_sessions += cint(d.no_of_sessions); | ||
if (d.amount) total_amount += flt(d.amount); | ||
}); | ||
frm.set_value('total_sessions', total_sessions); | ||
frm.set_value('total_amount', total_amount); | ||
frm.refresh_fields(); | ||
} | ||
}); | ||
|
||
frappe.ui.form.on('Therapy Plan Template Detail', { | ||
therapy_type: function(frm, cdt, cdn) { | ||
let row = locals[cdt][cdn]; | ||
frappe.call('frappe.client.get', { | ||
doctype: 'Therapy Type', | ||
name: row.therapy_type | ||
}).then((res) => { | ||
row.rate = res.message.rate; | ||
if (!row.no_of_sessions) | ||
row.no_of_sessions = 1; | ||
row.amount = flt(row.rate) * cint(row.no_of_sessions); | ||
frm.refresh_field('therapy_types'); | ||
frm.trigger('set_totals'); | ||
}); | ||
}, | ||
|
||
no_of_sessions: function(frm, cdt, cdn) { | ||
let row = locals[cdt][cdn]; | ||
row.amount = flt(row.rate) * cint(row.no_of_sessions); | ||
frm.refresh_field('therapy_types'); | ||
frm.trigger('set_totals'); | ||
}, | ||
|
||
rate: function(frm, cdt, cdn) { | ||
let row = locals[cdt][cdn]; | ||
row.amount = flt(row.rate) * cint(row.no_of_sessions); | ||
frm.refresh_field('therapy_types'); | ||
frm.trigger('set_totals'); | ||
} | ||
}); |
Oops, something went wrong.