qty summary by product name

report_acc_hdcase_summary
watcha.h 2017-04-12 14:58:35 +07:00
parent 7686215f9b
commit b9e122edf1
2 changed files with 27 additions and 0 deletions

View File

@ -321,6 +321,25 @@ class ReportAccountHDCaseSummary(Model):
else: else:
data['title']='Report - No Claim' data['title']='Report - No Claim'
data['title']='' #XXX data['title']='' #XXX
categs={}
for line in lines:
if line.get('hdcase_id'):
hdcase_id=line['hdcase_id']
hdcase=get_model("clinic.hd.case").browse(hdcase_id)
for line2 in hdcase.lines:
prod=line2.product_id
categ=line2.product_categ_id
if categ.code=='EPO':
categs.setdefault(prod.description, 0)
categs[prod.description]+=line2.qty or 0
data['categ_lines']=[]
for categ, qty in categs.items():
data['categ_lines'].append({
'name': categ,
'qty': qty,
})
return data return data
def onchange_date(self,context={}): def onchange_date(self,context={}):

View File

@ -8,7 +8,15 @@
<h4> <h4>
From {{date_from}} To {{date_to}} From {{date_from}} To {{date_to}}
</h4> </h4>
<p>
{{#each categ_lines}}
<b>{{name}}: {{qty}}&nbsp;&nbsp;&nbsp;&nbsp;</b>
{{/each}}
</p>
</center> </center>
<table class="table"> <table class="table">
<thead class="scroll-header"> <thead class="scroll-header">
<tr> <tr>