conv_bal
chayut.s 2014-10-27 10:30:35 +07:00
parent 96ca8834a3
commit 0a04faccf6
5 changed files with 0 additions and 217 deletions

View File

@ -1,8 +0,0 @@
<action>
<field name="string">Medical Report Summary</field>
<field name="view_cls">report</field>
<field name="model">clinic.report.hd.madical</field>
<field name="report_template">report_hd_madical</field>
<field name="report_template_xls">report_hd_madical</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -1,3 +0,0 @@
<form model="clinic.report.hd.madical">
<field name="date" mode="month" span="2"/>
</form>

View File

@ -1,177 +0,0 @@
import time
from datetime import datetime
from calendar import monthrange
from netforce.model import Model,fields,get_model
class ReportHDMadical(Model):
_name="clinic.report.hd.madical"
_string="Hemodialysis Report Madical Summary"
_transient=True
_fields={
"date": fields.Date("Month", required=True),
}
_defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"),
}
def get_report_data(self,ids,context={}):
for item in get_model("company").search_browse([]):
company_name=item.name
date=datetime.now().strftime("%Y-%m-%d")
#datemonth=datetime.now().strftime("%m")
if ids:
obj=self.browse(ids)[0]
date=obj.date
year=int(date[0:4])
month=int(date[5:7])
month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
next_month = str(month + 1)
if next_month == 13:
next_month = 12
#next_month_str=datetime.strptime(next_month,'%m').strftime("%B")
previous_month = str(month - 1)
if previous_month == 0:
previous_month = 12
#previous_month_str=datetime.strptime(previous_month,'%m').strftime("%B")
#madical=get_model("clinic.hd.case.gm.line").search_browse()
#patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
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)
dom=[]
dom.append(['state','=','completed'])
dom.append(['time_start','>=',time_start])
dom.append(['time_stop','<=',time_stop])
for product in get_model("clinic.hd.case.gm.line").search_browse([]):
product_id=product.product_id
print(product_id)
if product_id:
product_name=product.description or ""
product_id=product.product_id or ""
lines=[
{
'product_id' : 'MD-XXXX',
'madical' : product_name,
'sc': '437',
'uc': '',
'buy' : '4',
'total' : '441',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'H2',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epr4',
'sc': '216',
'uc': '',
'buy' : '',
'total' : '216',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epr2',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epk4',
'sc': '70',
'uc': '',
'buy' : '',
'total' : '70',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epk2',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epg4',
'sc': '98',
'uc': '',
'buy' : '',
'total' : '98',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epg2',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Rng4',
'sc': '34',
'uc': '',
'buy' : '9',
'total' : '43',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Rng2',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epi4',
'sc': '264',
'uc': '',
'buy' : '9',
'total' : '43',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Epi2',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
{
'product_id' : 'MD-XXXX',
'madical' : 'Vnf',
'sc': '',
'uc': '',
'buy' : '',
'total' : '',
},
]
data={
'month': month_str,
'year': year,
'lines': lines,
'company_name': company_name,
}
return data
ReportHDMadical.register()

View File

@ -1,29 +0,0 @@
<center>
<h2>
Summary of the Madical
</h2>
<h3>
[{{company_name}}]<br/>
As at {{month}} {{year}}
</h3>
</center>
<table class="table table-striped">
<thead class="scroll-header">
<th>Madical</th>
<th>Social Security</th>
<th>uc</th>
<th>Buy</th>
<th>Total</th>
</thead>
<tbody>
{{#each lines}}
<tr>
<td>{{madical}}</td>
<td>{{sc}}</td>
<td>{{uc}}</td>
<td style color="red"></style>{{buy}}</td>
<td style color="blue"></style>{{total}}</td>
</tr>
{{/each}}
</tbody>
</table>