report claim expense

conv_bal
watcha.h@almacom.co.th 2015-03-26 14:55:16 +07:00
parent e0a27017d8
commit 1fcc52bbb6
3 changed files with 31 additions and 12 deletions

View File

@ -74,6 +74,8 @@ class HDCase(Model):
res={}
user_id=get_active_user()
set_active_user(1)
reimbursable_ctx=context.get('reimbursable')
print('reimbursable_ctx ', reimbursable_ctx)
for obj in self.browse(ids):
dlz_use=0
dlz_max=0
@ -83,9 +85,9 @@ class HDCase(Model):
dz=dlz.dialyzer_id
dlz_id=dz.id
prod=dz.product_id
#name=dz.name or ""
#name=name.split()[-1]
name=prod.description
name=""
if prod:
name=prod.description or ""
dlz_name.append(name)
dlz_use+=dlz.use_time or 0
dlz_max+=dlz.max_use_time or 0
@ -101,6 +103,7 @@ class HDCase(Model):
for dline in obj.dialyzers:
dlz=dline.dialyzer_id
prod=dlz.product_id
if prod:
dlz_price+=prod.sale_price or 0
for line in obj.lines:
@ -121,9 +124,18 @@ class HDCase(Model):
elif categ.code=='FEE':
fee+=amt*sign
elif categ.code=='DLZ':
if prod:
dlz_price+=prod.sale_price or 0
elif categ.code=="LAB":
if reimbursable_ctx:
if reimbursable_ctx==line.reimbursable:
lab+=amt
else:
lab+=amt
else:
if reimbursable_ctx:
if reimbursable_ctx==line.reimbursable:
misc+=amt
else:
misc+=amt
res[obj.id]={
@ -387,6 +399,8 @@ class HDCase(Model):
line=get_data_path(data,path,parent=True)
product_id=line.get('product_id')
prod=get_model("product").browse(product_id)
if not prod:
return data
if prod.can_sell:
line['reimbursable']='no'
else:

View File

@ -105,7 +105,8 @@ class ReportAccountHDCaseSummary(Model):
dom.append(['product_id','=',product_id])
records={}
cycles={}
for line in get_model("clinic.hd.case.line").search_browse(dom):
context['reimbursable']=reimbursable
for line in get_model("clinic.hd.case.line").search_browse(dom,context=context):
hdcase=line.hd_case_id
items={}
mdc_name=(hdcase.epo or "").split("-")

View File

@ -38,7 +38,7 @@
<th>สิทธิ์</th>
<th>Receipt#</th>
<th>Invoice#</th>
<th>EPO</th>
<th>ชื่อยา</th>
<th>ค่าฟอก</th>
<th>ค่ายา</th>
<th>Lab</th>
@ -55,7 +55,7 @@
<th>ID Card</th>
<th>สิทธิ์</th>
<th>HCT%</th>
<th>EPO</th>
<th>ชื่อยา</th>
<th>ค่าฟอก</th>
<th>ค่ายา</th>
<th>ค่าบริการฉีดยา</th>
@ -80,14 +80,18 @@
<td style="width:20%">{{idcard}}</td>
<td>{{ptype}}</td>
<td>{{pm_number}}</td>
<td>{{inv_number}}</td>
<td>
{{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
</td>
<td>{{epo_name}}</td>
<td>{{currency fee zero=""}}</td>
<td>{{currency epo zero=""}}</td>
<td>{{currency lab zero=""}}</td>
<td>{{currency misc zero=""}}</td>
<td>{{currency dlz_price zero=""}}</td>
<td>{{inv_ref}}</td>
<td>
{{view "link" string=inv_ref action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}}
</td>
<td>
{{#if pick_id}}
{{view "link" string=pick_ref action="pick_out" action_options="mode=form" active_id=pick_id}}