diff --git a/netforce_clinic/layouts/clinic_cycle_item_form.xml b/netforce_clinic/layouts/clinic_cycle_item_form.xml
index da64d23..78b55e8 100644
--- a/netforce_clinic/layouts/clinic_cycle_item_form.xml
+++ b/netforce_clinic/layouts/clinic_cycle_item_form.xml
@@ -11,25 +11,27 @@
+
+
-
+
+ -->
diff --git a/netforce_clinic/layouts/clinic_hd_case_form.xml b/netforce_clinic/layouts/clinic_hd_case_form.xml
index 8cf3fbd..e007079 100644
--- a/netforce_clinic/layouts/clinic_hd_case_form.xml
+++ b/netforce_clinic/layouts/clinic_hd_case_form.xml
@@ -6,7 +6,7 @@
-
+
@@ -19,7 +19,7 @@
-
+
@@ -37,7 +37,7 @@
-
+
@@ -52,9 +52,10 @@
-
+
+
@@ -70,10 +71,9 @@
-
-
-
-
+
+
+
{{#each context.data}}
@@ -88,14 +88,13 @@
{{/each}}
-
-
-
+
+
@@ -109,15 +108,15 @@
-
-
+
+
-
+
diff --git a/netforce_clinic/layouts/clinic_prod_categ_form.xml b/netforce_clinic/layouts/clinic_prod_categ_form.xml
new file mode 100644
index 0000000..495c68c
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_prod_categ_form.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/netforce_clinic/layouts/clinic_prod_categ_list.xml b/netforce_clinic/layouts/clinic_prod_categ_list.xml
new file mode 100644
index 0000000..682cad0
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_prod_categ_list.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index 95564c1..f1ac2e1 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -81,3 +81,4 @@ from . import labor_cost_staff
from . import labor_cost_entry
from . import labor_cost_entry_line
from . import sickbed
+from . import product_categ
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index e2ea62a..9addf7e 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -32,33 +32,21 @@ class HDCase(Model):
def _get_all(self,ids,context={}):
vals={}
for obj in self.browse(ids):
- total=0
+ total_amt=0
+ rmb_amt=0
due_amt=0
- fee_amt=0
- mdc_amt=0
- srv_amt=0
for line in obj.lines:
- if line.type=='fee':
- fee_amt+=line.amount or 0.0
- elif line.type=='medicine':
- mdc_amt+=line.amount or 0.0
- elif line.type=='service':
- srv_amt+=line.amount or 0.0
- total+=line.amount or 0.0
- if obj.invoice_policy=='fee':
- due_amt=total-fee_amt
- elif obj.invoice_policy=='fee_mdc':
- due_amt=total-(fee_amt+mdc_amt)
- else:
- due_amt=total
+ if line.reimbursable:
+ rmb_amt+=line.amount or 0.0
+ else:
+ due_amt+=line.amount or 0.0
+ total_amt+=line.amount or 0.0
for line in obj.payment_lines:
due_amt-=line.amount or 0.0
vals[obj.id]={
- "total": total,
- "amount": due_amt,
- 'fee_amount': fee_amt,
- 'mdc_amount': mdc_amt,
- 'srv_amount': srv_amt,
+ "total_amount": total_amt,
+ "due_amount": due_amt,
+ 'rmb_amount': rmb_amt,
'hd_case_id': obj.id,
}
return vals
@@ -105,11 +93,9 @@ class HDCase(Model):
"expenes": fields.One2Many("clinic.hd.case.expense","hd_case_id","Expenses"),
'visit_id': fields.Many2One("clinic.visit", "Visit"),
'duration': fields.Integer("Duration (Hours)",function="_get_duration"),
- "total": fields.Float("Total",function="_get_all",readonly=True,function_multi=True),
- "fee_amount": fields.Float("Fee",function="_get_all",readonly=True,function_multi=True),
- "mdc_amount": fields.Float("Medicine",function="_get_all",readonly=True,function_multi=True),
- "srv_amount": fields.Float("Service",function="_get_all",readonly=True,function_multi=True),
- "amount": fields.Float("Due Amount",function="_get_all",readonly=True,function_multi=True),
+ "total_amount": fields.Float("Total",function="_get_all",readonly=True,function_multi=True),
+ "rmb_amount": fields.Float("Reimbursable",function="_get_all",readonly=True,function_multi=True),
+ "due_amount": fields.Float("Due Amount",function="_get_all",readonly=True,function_multi=True),
'fee_partner_id': fields.Many2One("partner","Contact Fee"),
'fee_paid': fields.Boolean("Fee Paid"),
'note': fields.Text("Note"),
@@ -250,6 +236,7 @@ class HDCase(Model):
prod=get_model("product").browse(product_id)
line['uom_id']=prod.uom_id.id
line['description']=prod.name
+ line['product_categ_id']=prod.categ_id.id
qty=1
price=prod.sale_price or 0.0
amt=qty*price
@@ -267,48 +254,21 @@ class HDCase(Model):
data['pay_amount']=0
return data
- def onchange_type(self,context={}):
- data=self.onchange_policy(context)
- return data
-
- def onchange_policy(self,context={}):
- data=context['data']
- data=self.update_amount(context)
- return data
-
def update_amount(self,context={}):
data=context['data']
- inv_pol=data['invoice_policy']
- total=0.0
- fee=0.0
- mdc=0.0
- srv=0.0
due_amt=0.0
+ rmb_amt=0.0
for line in data['lines']:
amt=line['amount'] or 0.0
- total+=amt
- ltype=line['type']
- if ltype=='fee':
- fee+=amt
- elif ltype=='medicine':
- mdc+=amt
- elif ltype=='service':
- srv+=amt
- elif ltype=='others':
- pass
- if inv_pol=='fee':
- due_amt=total-fee
- data['invoice_option']=''
- elif inv_pol=='fee_mdc':
- due_amt=total-fee-mdc
- data['invoice_option']='fee_mdc_split'
- else:
- due_amt=total
- data['total']=total
- data['fee_amount']=fee
- data['mdc_amount']=mdc
- data['srv_amount']=srv
- data['amount']=due_amt
+ reimbursable=line['reimbursable']
+ if reimbursable=='yes':
+ rmb_amt+=amt
+ else:
+ due_amt+=amt
+ print("xx ", rmb_amt, due_amt)
+ data['rmb_amount']=rmb_amt
+ data['due_amount']=due_amt
+ data['total_amount']=due_amt+rmb_amt
return data
def make_payment(self,ids,context={}):
@@ -630,6 +590,8 @@ class HDCase(Model):
return True
def do_expense(self,ids,context={}):
+ return
+ #TODO
for obj in self.browse(ids):
# clear old expense
for exp in obj.expenes:
diff --git a/netforce_clinic/models/hd_case_line.py b/netforce_clinic/models/hd_case_line.py
index 7e9fbd4..41ffa05 100644
--- a/netforce_clinic/models/hd_case_line.py
+++ b/netforce_clinic/models/hd_case_line.py
@@ -11,10 +11,13 @@ class Hdcaseline(Model):
"price":fields.Float("Price"),
"amount":fields.Float("Amount"),
"type": fields.Selection([("fee","Fee"),('medicine','Medicine'),('service','Service'),("others","Others")],"Type",required=True),
+ "product_categ_id": fields.Many2One("product.categ","Category",domain=[['expense','=',True]]),
+ 'reimbursable': fields.Selection([['yes','Yes'],['no','No']],"Reimbursable"),
}
_defaults={
'type': 'others',
+ 'reimbursable': False,
}
Hdcaseline.register()
diff --git a/netforce_clinic/models/hd_case_staff.py b/netforce_clinic/models/hd_case_staff.py
index ae6195b..3b24fa6 100644
--- a/netforce_clinic/models/hd_case_staff.py
+++ b/netforce_clinic/models/hd_case_staff.py
@@ -5,15 +5,15 @@ class HdCaseStaff(Model):
_name_field="staff_id"
_fields={
"hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
- "staff_id": fields.Many2One("clinic.staff","Staff",search=True),
+ "staff_id": fields.Many2One("clinic.staff","Doctor",search=True),
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("staff","Staff")],"Type",required=True),
"priop": fields.Selection([("owner","Owner"),('second','Secondary'),('other','Other')],"Priority"),
'note': fields.Char("Note"),
}
_defaults={
- 'type': 'nurse',
- 'priop': 'other',
+ 'type': 'doctor',
+ 'priop': 'second',
}
HdCaseStaff.register()
diff --git a/netforce_clinic/models/product_categ.py b/netforce_clinic/models/product_categ.py
new file mode 100644
index 0000000..5d89d19
--- /dev/null
+++ b/netforce_clinic/models/product_categ.py
@@ -0,0 +1,13 @@
+from netforce.model import Model, fields
+
+class ProductCateg(Model):
+ _inherit="product.categ"
+ _fields={
+ 'expense': fields.Boolean("Expense"),
+ }
+
+ _defaults={
+ 'expense': False,
+ }
+
+ProductCateg.register()
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index ccf1625..07df05e 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,35 +1,3 @@
-=====
-cycle item
- - list's nurse
- - list hd case + U
- - xxx
- - change datetime
-
-visit:
- - confirm
- - copy data to hdcase -> cycle item
-=====
- - design
- 1. create cycle item
-
-=====
-
-
-==== after midnight, create payment
-
-
-
-====
- if patient not do visit before treatment , how to do?
-==
-import payment
-======
- import payment
- step:
- 1. check matching
- 2. prepare file to import
- 3. import
- - find import
- -
- - change day schedue relate
-======
+categ_id
+product_id
+ca