conv_bal
watcha.h 2014-10-28 20:39:29 +07:00
parent d2e0bd55c2
commit 6bdbe444b2
10 changed files with 77 additions and 178 deletions

View File

@ -6,6 +6,7 @@
<field name="name"/>
<field name="duration"/>
<field name="sequence"/>
<field name="color"/>
<related>
<field name="cycle_items"/>
<field name="visits"/>

View File

@ -2,4 +2,5 @@
<field name="name"/>
<field name="duration"/>
<field name="sequence"/>
<field name="color"/>
</list>

View File

@ -14,6 +14,8 @@
<field name="wednesday" span="4"/>
<field name="thursday" span="4"/>
<field name="friday" span="4"/>
<field name="sathurday" span="4"/>
<field name="sunday" span="4"/>
<field name="lines" nolabel="1">
<list>
<field name="patient_id"/>

View File

@ -13,7 +13,7 @@
<foot replace="1">
<button string="Import Data" method="import_sc" type="primary" icon="arrow-right"/>
<!--<button string="Match Invoice" method="match_invoice_sc" icon="retweet" type="default"/>-->
<button string="Pay Invoice" method="post_sc" icon="ok" type="success"/>
<button string="Approve" method="approve_sc" icon="ok" type="success"/>
<button string="Clear" method="clear_sc" type="danger" icon="remove"/>
</foot>
</form>

View File

@ -14,6 +14,7 @@ class Cycle(Model):
'visits': fields.One2Many("clinic.visit","cycle_id", "Visits"),
'cycle_items': fields.One2Many("clinic.cycle.item","cycle_id", "Cycle Items"),
'var_k': fields.Float("K"),
'color': fields.Char("Color"),
}
_defaults={

View File

@ -1,3 +1,4 @@
import re
import time
from netforce.model import Model, fields, get_model
@ -63,6 +64,7 @@ class CycleItem(Model):
}
def compute(self,ids,context={}):
# XXX should compute after hd case done
for obj in self.browse(ids):
vals={
'nurse_lines': [],
@ -139,21 +141,79 @@ class CycleItem(Model):
'flash': 'Compute OK',
}
def reduce_formular(self,line_strs=None):
def get_lines(line_str):
return line_strs.replace("\n","").replace(" ","").split(",")
line2=[]
m='/(\d+)'
for line in get_lines(line_strs):
res=re.findall(m,line)
if res:
x1=res[0]
line=line.replace("/%s"%x1,"")
line=line.replace("(","")
line=line.replace(")","")
p1='x'
res=re.findall(p1,line)
if res:
line=line.replace("x",'x/%s'%x1)
p2='[-,+,*]\d+'
res=re.findall(p2,line)
if res:
for r in res:
x2=float(r)/float(x1)
x2=x2> 0 and '+%s'%x2 or x2
line=line.replace(r,str(x2))
if line:
line2.append(line)
return line2
def match_value(self,items):
for qty, f in items:
p1='x'
res=re.findall(p1,f)
if res:
f=f.replace("x",'%sx'%qty)
p2='([-,+,*])(\d+)'
res=re.findall(p2,f)
#XXX
if res:
#print('res ', res)
sym=res[0][0]
v=res[0][1]
sym_v=''.join([sym,str(int(v)*int(qty))])
old_v=''.join([sym,str(int(v))])
#print('-'*50)
#print(f)
#print(old_v, " ", sym_v)
f=f.replace('%s'%str(old_v),'%s'%str(sym_v))
#print(f)
#print('-'*50)
print(f)
def onchange_line(self,context={}):
data=context['data']
path=context["path"]
line=get_data_path(data,path,parent=True)
#pt=data['pt'] or 0.0
#k=data['var_k'] or 0.0
#x=(pt*k+n2*100+n3*250-n4*25-n5*25+n6*75)/(n1+n2+n3+0.5*(n4+n5+n6))
#qty=line.get("qty")
#rate=line.get("rate")
total=0.0
items=[]
values=[]
for line in data['nurse_lines']:
#line['amount']=(line['qty'] or 0) * (line['rate'] or 0.0)
formular=line['formular']
print(formular)
values.append(line['qty'])
items.append(formular)
qty=line['qty']
rate=line['rate']
line['amount']=qty*rate
total+=line['amount']
formulars=self.reduce_formular(','.join(items))
res=self.match_value(list(zip(values,formulars)))
data['total']=total
data['total_amount']=data['total_pt']*(data['var_k'] or 0)
data['total_balance']=data['total_amount']-data['total']

View File

@ -27,6 +27,8 @@ class GenVisit(Model):
'wednesday': fields.Boolean("Wednesdays"),
'thursday': fields.Boolean("Thursdays"),
'friday': fields.Boolean("Fridays"),
'sathurday': fields.Boolean("Sathurday"),
'sunday': fields.Boolean("Sunday"),
'doctor_id': fields.Many2One("clinic.doctor","Doctor"),
'nurse_id': fields.Many2One("clinic.nurse","Nurse"),
'department_id': fields.Many2One("clinic.department","Department"),
@ -93,6 +95,8 @@ class GenVisit(Model):
obj.wednesday and 3 or 0,
obj.thursday and 4 or 0,
obj.friday and 5 or 0,
obj.sathurday and 6 or 0,
obj.sunday and 7 or 0,
]
days=[day for day in days if day]
if not days:

View File

@ -197,9 +197,6 @@ class ImportPayment(Model):
fpath=get_file_path(fname)
print("fpath ", fpath)
def test_sc(self,ids,context={}):
pass
def clear_sc(self,ids,context={}):
sc_ids=get_model("clinic.data.sc").search([])
get_model("clinic.data.sc").delete(sc_ids)
@ -218,7 +215,7 @@ class ImportPayment(Model):
'result': 'Match OK',
})
def post_sc(self,ids,context={}):
def approve_sc(self,ids,context={}):
settings=get_model("settings").browse(1)
account_id=settings.ap_sc_id.id
if not account_id:

View File

@ -17,6 +17,7 @@ class NurseCateg(Model):
"company_id": lambda *a: get_active_company(),
'sequence': 0,
'type': 'doctor',
'formular': '',
}
_order="sequence"

View File

@ -1,171 +1,3 @@
====
-todo:
- make script to import hd case
---
question:
- can filter field in related
find dialyzer automatic after confirm visit
====
- import data
- payment
- NHSO
- SSO
=====
select diaylizer at treatment page -> ok
=====
step:
nurse
1. go to visit calendar
- auto gen visit
2. go to visit
- confirm
- copy data to hd case
- patient
- doctor
- department
- nurse
- other ...
- auto generate cycle (4 cycle)
3. go to hd case
- select dialyzer
- if not we can no do treament
===== todo
######
- import payment
- visit planing
######
========
Account Receivable -> invoice
find account id
1. partner
2. product line
3. settings
Account Payable -> payment
!!! import data
- remove payment
set account payable
issue:
date of visit is not copy after click from calendar
======
!!! this night
- import payment
setting account
- debit
- credit
patient
- type
-nhso สปสช
- center office of healthcare information
- sc ประักนสังคม
- mg
task
1. find invoice
2. match invoice
- date, number for patient (HN)
3. if have invoice create payment if not review input data again
4. post payment to journal
===========================
- main
- create journal entry from file import
- detail (if have some time need to approve)
- defind state for each step
- visit
- treatment
- dializer
- defind flow of each step
- patient
- new
- load default data
- one2many
- visit
-> split date and time ->ok
-> state
- draft
- confirmed
- should select dialyzer before treament
- buttons -> ok
- confirm
- state : draft -> waiting treatment
- do treatment
- state : waiting treatment ->
- cancel visit -> ok
- print visit -> ok
- treament
- visit planing
- find visit of patient which state is close
- print invoice
- pay for normal person
-> how ???
- make payment
- time start/stop -> ok
- only time
- date treament ->ok
- color (check state)
- if fail -> red
- cancelled
- make next appointment -> ok
- state
- ready to treatment
- paid -> no because not realte to accounting
- many2one for dializer
- list show percent of progress bar
- plaining visit !!!
- select next day to visit
- copy data to visit
- after click complete
- day [monday, tueday, wedsday, thursday, friday]
- time
- dialyzer
- import payment
- import
- create payment with invoice that found
- post
- undo
=======
sequence (support multi company) -> ok
- visit
- hd case
- create invoice after validate ->ok
- create stock picking -> no
- doctor
- nurse
- patient
create new hd case after confirm visit ->ok
question?
- how cycle running?
- treatment
- 1 cycle take how long ?
issue:
hd case should link only 1 dialyzer -> should not copy 2 time
create journal entry
-> ok
sunday
todo:
- need to close all issue:
https://docs.google.com/spreadsheets/d/1GDl9vCswHlD1MMfVwRS504keIz9NYL8VhUZlSPDEJvk/edit?usp=drive_web
payment
- personal
- government
set visible for each staus
======= import data
- flow
1. select sheet
2. select columns
3. load data -> load payment
4. review data -> review payment
5. import data -> post payment
6. done
- issue
load excel is very slow
formalar
tick:
find all -> replace -> multiple x