fix report claim expense

conv_bal
watcha.h@almacom.co.th 2015-03-25 17:32:36 +07:00
parent 68cffef58b
commit 5b9bd61c46
1 changed files with 20 additions and 22 deletions

View File

@ -71,40 +71,38 @@ class ReportAccountHDCaseSummary(Model):
reimbursable=obj.reimbursable reimbursable=obj.reimbursable
cycle_id=obj.cycle_id.id cycle_id=obj.cycle_id.id
dom=[ dom=[
['date','>=', date_from], ['hd_case_id.date','>=', date_from],
['date','<=', date_to], ['hd_case_id.date','<=', date_to],
['patient_id.walkin','=','no'], ['hd_case_id.patient_id.walkin','=','no'],
] ]
if ptype_id: if ptype_id:
dom.append(['patient_type_id','=',ptype_id]) dom.append(['hd_case_id.patient_type_id','=',ptype_id])
if branch_id: if branch_id:
dom.append(['branch_id','=',branch_id]) dom.append(['hd_case_id.branch_id','=',branch_id])
if department_id: if department_id:
dom.append(['department_id','=',department_id]) dom.append(['hd_case_id.department_id','=',department_id])
if cycle_id: if cycle_id:
dom.append(['cycle_id','=',cycle_id]) dom.append(['hd_case_id.cycle_id','=',cycle_id])
if reimbursable=='yes': if reimbursable:
dom.append(['state','in',['waiting_payment']]) dom.append(['reimbursable','=',reimbursable])
elif reimbursable=='no':
dom.append(['state','in',['paid']])
else: else:
dom.append(['state','in',['completed','waiting_payment','paid']]) dom.append(['hd_case_id.state','in',['completed','waiting_payment','paid']])
lines=[] lines=[]
cycles={} cycles={}
for hdcase in get_model("clinic.hd.case").search_browse(dom): for line in get_model("clinic.hd.case.line").search_browse(dom):
hdcase=line.hd_case_id
items={} items={}
mdc_name=(hdcase.epo or "").split("-") mdc_name=(hdcase.epo or "").split("-")
if mdc_name: if mdc_name:
mdc_name=mdc_name[0].title() mdc_name=mdc_name[0].title()
for line in hdcase.lines: amt=line.amount or 0
amt=line.amount or 0 categ=line.product_categ_id
categ=line.product_categ_id code=(categ.code or "").lower()
code=(categ.code or "").lower() if not code in items.keys():
if not code in items.keys(): items[code]=[]
items[code]=[] items[code].append({
items[code].append({ 'amount': amt,
'amount': amt, })
})
pm_number=','.join([pm.number for pm in hdcase.payments if pm.number]) pm_number=','.join([pm.number for pm in hdcase.payments if pm.number])
inv_number="" inv_number=""
inv_ref="" inv_ref=""