diff --git a/netforce_clinic/actions/clinic_invoice_payment.xml b/netforce_clinic/actions/clinic_invoice_payment.xml
index 29ec4ca..b1da7a7 100644
--- a/netforce_clinic/actions/clinic_invoice_payment.xml
+++ b/netforce_clinic/actions/clinic_invoice_payment.xml
@@ -7,6 +7,7 @@
["All",[]],
["Draft",[["state","=","draft"]]],
["Approved",[["state","=","approved"]]],
+ ["Waiting Approval",[["state","=","waiting_approve"]]],
["Completed",[["state","=","done"]]]
]
diff --git a/netforce_clinic/layouts/clinic_invoice_payment_form.xml b/netforce_clinic/layouts/clinic_invoice_payment_form.xml
index 434787e..c8f4f17 100644
--- a/netforce_clinic/layouts/clinic_invoice_payment_form.xml
+++ b/netforce_clinic/layouts/clinic_invoice_payment_form.xml
@@ -9,7 +9,7 @@
-
+
@@ -22,9 +22,13 @@
+
+
+
+
diff --git a/netforce_clinic/layouts/clinic_invoice_payment_list.xml b/netforce_clinic/layouts/clinic_invoice_payment_list.xml
index 7d2da9b..655363e 100644
--- a/netforce_clinic/layouts/clinic_invoice_payment_list.xml
+++ b/netforce_clinic/layouts/clinic_invoice_payment_list.xml
@@ -1,4 +1,8 @@
-
+
+
+
+
+
diff --git a/netforce_clinic/layouts/clinic_matching_payment_form.xml b/netforce_clinic/layouts/clinic_matching_payment_form.xml
index 5cd9788..90791f6 100644
--- a/netforce_clinic/layouts/clinic_matching_payment_form.xml
+++ b/netforce_clinic/layouts/clinic_matching_payment_form.xml
@@ -47,6 +47,6 @@
-
+
diff --git a/netforce_clinic/layouts/clinic_matching_payment_list.xml b/netforce_clinic/layouts/clinic_matching_payment_list.xml
index 17db0b6..70df2e9 100644
--- a/netforce_clinic/layouts/clinic_matching_payment_list.xml
+++ b/netforce_clinic/layouts/clinic_matching_payment_list.xml
@@ -1,7 +1,11 @@
-
+
-
+
+
+
+
+
diff --git a/netforce_clinic/models/invoice_payment.py b/netforce_clinic/models/invoice_payment.py
index 824c9fb..5504c21 100644
--- a/netforce_clinic/models/invoice_payment.py
+++ b/netforce_clinic/models/invoice_payment.py
@@ -2,7 +2,7 @@ import time
from netforce.model import Model, fields, get_model
from netforce.utils import get_data_path
-from netforce.access import get_active_company
+from netforce.access import get_active_company, get_active_user
class InvoicePayment(Model):
_name="clinic.invoice.payment"
@@ -12,14 +12,26 @@ class InvoicePayment(Model):
res={}
for obj in self.browse(ids):
total=0
+ total_fee=0
+ total_srv=0
+ total_epo=0
for line in obj.lines:
matching=line.matching_id
for mline in matching.lines:
- total+=mline.fee or 0
- total+=mline.srv or 0
- total+=mline.epo or 0
+ fee=mline.fee or 0
+ total+=fee
+ total_fee+=fee
+ srv=mline.srv or 0
+ total+=srv
+ total_srv+=srv
+ epo=mline.epo or 0
+ total+=epo
+ total_epo+=epo
res[obj.id]={
'total': total,
+ 'total_epo': total_epo,
+ 'total_fee': total_fee,
+ 'total_srv': total_srv,
}
return res
@@ -27,8 +39,12 @@ class InvoicePayment(Model):
'name': fields.Char("Name",required=True),
'lines': fields.One2Many("clinic.invoice.payment.line","invoice_payment_id", "Lines"),
'total': fields.Float("Total",function="_get_all",function_multi=True),
- 'state': fields.Selection([['draft','Draft'],['waiting_approve','Waiting Approve'],['approved','Approved'],['done','Done']],'State'),
+ 'total_fee': fields.Float("FEE",function="_get_all",function_multi=True),
+ 'total_epo': fields.Float("EPO",function="_get_all",function_multi=True),
+ 'total_srv': fields.Float("Service",function="_get_all",function_multi=True),
+ 'state': fields.Selection([['draft','Draft'],['waiting_approve','Waiting Approval'],['approved','Approved'],['done','Done']],'State'),
'date': fields.Date("Date"),
+ 'user_id': fields.Many2One("base.user","Approver"),
}
_defaults={
@@ -36,7 +52,7 @@ class InvoicePayment(Model):
'date': lambda *a: time.strftime("%Y-%m-%d"),
}
- def approve(self,ids,context={}):
+ def send_to_payment(self,ids,context={}):
count=0
for obj in self.browse(ids):
res=obj.make_payment()
@@ -44,6 +60,13 @@ class InvoicePayment(Model):
if res<=1:
return res
+ def approve(self,ids,context={}):
+ for obj in self.browse(ids):
+ obj.write({
+ 'state': 'approve',
+ 'user_id': get_active_user(),
+ })
+
def make_payment(self,ids,context={}):
obj=self.browse(ids)[0]
lines=[]
@@ -113,7 +136,7 @@ class InvoicePayment(Model):
'state': 'draft',
})
- def sumbit(self,ids,context={}):
+ def submit(self,ids,context={}):
obj=self.browse(ids)[0]
obj.write({
'state': 'waiting_approve',
diff --git a/netforce_clinic/models/matching_payment.py b/netforce_clinic/models/matching_payment.py
index b428c44..8aeba9e 100644
--- a/netforce_clinic/models/matching_payment.py
+++ b/netforce_clinic/models/matching_payment.py
@@ -156,6 +156,8 @@ class MatchingPayment(Model):
elif invoice.ref:
pname=invoice.ref or ''
pname=pname.replace(" ","") # remove space
+ for pt in get_model("clinic.patient").search_browse([['name_check','=',pname]]):
+ hn=pt.hn_no or ""
else:
pass
fee,epo,srv=0, 0, 0
@@ -409,7 +411,7 @@ class MatchingPayment(Model):
'hn': record['hn'],
'pid': record['pid'],
'name': record['name'],
- 'fee': record['fee_amt'],
+ 'fee': record['fee'],
'invoice_id': record['invoice_id'],
'state': state,
}
@@ -491,4 +493,5 @@ class MatchingPayment(Model):
'state': 'draft',
})
+
MatchingPayment.register()
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index cf10cd9..a1671fc 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,5 +1,8 @@
todo:
- convbal -> not yet (wait yui)
+
+
+ convbal -> not yet (wait yui) -> ok but have to update memo
+
post 10,000 invoices per one time -> ask david
patient & staff
- split name -> not yet