report hd case monthly

conv_bal
watcha.h 2014-10-15 19:39:21 +07:00
parent 57f74cb0c7
commit bbef690e0c
5 changed files with 43 additions and 84 deletions

View File

@ -2,5 +2,5 @@
<field name="string">Import Payments From Government</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.import.payment</field>
<field name="menu">clinic_menu</field>
<field name="menu">account_menu</field>
</action>

View File

@ -7,6 +7,7 @@
<field name="type" required="1"/>
<field name="input_id" readonly="1"/>
<field name="mg_payment_id" readonly="1"/>
<field name="file" readonly="1"/>
<foot>
<button span="3" size="large" icon="arrow-right" string="Import" type="primary" method="import"/>
</foot>

View File

@ -1,6 +1,8 @@
import time
from datetime import datetime
from calendar import monthrange
from netforce.model import Model, fields
from netforce.model import Model, fields, get_model
class HDReportMonth(Model):
_name="clinic.hd.report.monthly"
@ -8,7 +10,7 @@ class HDReportMonth(Model):
_transient=True
_fields={
"date": fields.Date("Month"),
"date": fields.Date("Month", required=True),
}
_defaults={
@ -16,7 +18,33 @@ class HDReportMonth(Model):
}
def get_report_data(self,ids,context={}):
data={}
if not ids:
return {}
obj=self.browse(ids)[0]
year=int(obj.date[0:3])
month=int(obj.date[5:7])
month_str=datetime.strptime(obj.date,'%Y-%m-%d').strftime("%B")
weekday, total_day=monthrange(year, month)
time_start='2014-%s-01 00:00:00'%(month)
time_stop='2014-%s-%s 23:59:59'%(month,total_day)
lines=[]
dom=[]
dom.append(['state','=','completed'])
dom.append(['time_start','>=',time_start])
dom.append(['time_stop','<=',time_stop])
hd_cases=get_model("clinic.hd.case").search_browse(dom)
print("="*50)
for hd_case in hd_cases:
lines.append({
'topic': 'The number of times the Hemodialysis',
'month': month_str,
'amount': len(hd_cases),
})
data={
'lines': lines,
}
return data
HDReportMonth.register()

View File

@ -9,87 +9,17 @@
</center>
<table class="table table-striped">
<thead class="scroll-header">
<th>Topic</th>
<th>Month</th>
<th>Amount</th>
</thead>
<tbody>
{{#each lines}}
<tr>
<th>
The number of times the Hemodialysis
</th>
<th>
Current month
</th>
<th>
xxxx times
</th>
</tr>
<tr>
<th>
Many patients come from
</th>
<th>
Previous month
</th>
<th>
xxxx person
</th>
</tr>
<tr>
<th>
Number of new patients
</th>
<th>
Current month
</th>
<th>
xxxx person
</th>
</tr>
<tr>
<th>
Number of patients discharged
</th>
<th>
Current month
</th>
<th>
xxxx person
</th>
</tr>
<tr>
<th>
Number of patients to raise
</th>
<th>
Current month
</th>
<th>
xxxx person
</th>
</tr>
<tr>
<th>
Number of patients withdrawn SSO
</th>
<th>
</th>
<th>
xxxx person
</th>
</tr>
<tr>
<th>
Many patients pay themselves
</th>
<th>
</th>
<th>
xxxx person
</th>
<td>{{topic}}</td>
<td>{{month}}</td>
<td>{{amount}}</td>
</tr>
{{/each}}
</tbody>
<tfoot>
<tr style="font-weight:bold">
</tr>
</tfoot>
</table>