rename report

conv_bal
watcha.h 2014-10-15 22:55:38 +07:00
parent 9803d1799a
commit eb83fcfc51
8 changed files with 48 additions and 40 deletions

View File

@ -1,8 +1,8 @@
<action> <action>
<field name="string">HD Report Dialy</field> <field name="string">Report HD Dialy</field>
<field name="view_cls">report</field> <field name="view_cls">report</field>
<field name="model">clinic.hd.report.dialy</field> <field name="model">clinic.report.hd.dialy</field>
<field name="report_template">report_hd_report_dialy</field> <field name="report_template">report_hd_dialy</field>
<field name="report_template_xls">hd_report_dialy</field> <field name="report_template_xls">report_hd_dialy</field>
<field name="menu">clinic_menu</field> <field name="menu">clinic_menu</field>
</action> </action>

View File

@ -1,8 +1,8 @@
<action> <action>
<field name="string">Summary of the Hemodialysis</field> <field name="string">Report HD Monthly</field>
<field name="view_cls">report</field> <field name="view_cls">report</field>
<field name="model">clinic.hd.report.monthly</field> <field name="model">clinic.report.hd.monthly</field>
<field name="report_template">report_hd_monthly</field> <field name="report_template">report_hd_monthly</field>
<field name="report_template_xls">hd_report_monthly</field> <field name="report_template_xls">report_hd_monthly</field>
<field name="menu">clinic_menu</field> <field name="menu">clinic_menu</field>
</action> </action>

View File

@ -21,8 +21,8 @@
<item string="Treatments" action="clinic_hd_case"/> <item string="Treatments" action="clinic_hd_case"/>
<item string="Reports"> <item string="Reports">
<header string="HD CASE"/> <header string="HD CASE"/>
<item string="Daily" action="clinic_hd_report"/> <item string="Daily" action="clinic_report_hd_dialy"/>
<item string="Monthly" action="clinic_hd_report_monthly"/> <item string="Monthly" action="clinic_report_hd_monthly"/>
</item> </item>
<item string="Settings"> <item string="Settings">
<item string="Departments" action="clinic_department"/> <item string="Departments" action="clinic_department"/>

View File

@ -1,6 +1,7 @@
<form model="clinic.hd.report.dialy"> <form model="clinic.report.hd.dialy">
<group> <group>
<field name="date" span="2"/> <field name="date_from" span="2"/>
<field name="date_to" span="2"/>
<field name="cycle_id" span="2"/> <field name="cycle_id" span="2"/>
<field name="patient_id" span="2"/> <field name="patient_id" span="2"/>
<field name="nurse_id" span="2"/> <field name="nurse_id" span="2"/>

View File

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

View File

@ -2,25 +2,23 @@ import time
from netforce.model import Model, fields, get_model from netforce.model import Model, fields, get_model
class HDReportDialy(Model): class ReportHDDialy(Model):
_name="clinic.hd.report.dialy" _name="clinic.report.hd.dialy"
_string="HD Report Dialy" _string="Report HD Dialy"
_transient=True _transient=True
_fields={ _fields={
"date": fields.Date("Start-Date"),
"patient_id" : fields.Many2One("clinic.patient","Patient"), "patient_id" : fields.Many2One("clinic.patient","Patient"),
"doctor_id" : fields.Many2One("clinic.doctor","Doctor"), "doctor_id" : fields.Many2One("clinic.doctor","Doctor"),
"nurse_id" : fields.Many2One("clinic.nurse","Nurse"), "nurse_id" : fields.Many2One("clinic.nurse","Nurse"),
#"time_start": fields.DateTime("Time start",required=False,search=True), "date_from": fields.Date("From"),
#"time_stop": fields.DateTime("Time stop",required=False,search=True), "date_to": fields.Date("To"),
"cycle_id": fields.Many2One("clinic.cycle","Cycle"), "cycle_id": fields.Many2One("clinic.cycle","Cycle"),
} }
_defaults={ _defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"), 'date_from': lambda *a: time.strftime("%Y-%m-%d"),
#'time_start': lambda *a: time.strftime("%Y-%m-%d"), 'date_to': lambda *a: time.strftime("%Y-%m-%d"),
#'time_stop': lambda *a: time.strftime("%Y-%m-%d"),
} }
_order="cycle_id desc" _order="cycle_id desc"
@ -34,15 +32,18 @@ class HDReportDialy(Model):
"personal": "Personal", "personal": "Personal",
"others": "Others", "others": "Others",
} }
#time_start=time.strftime("%Y-%m-%d")
#time_stop=time.strftime("%Y-%m-%d") date_from=time.strftime("%Y-%m-%d")
date=time.strftime("%Y-%m-%d") date_to=time.strftime("%Y-%m-%d")
dom=[] dom=[]
dom.append(['state','=','completed']) dom.append(['state','=','completed'])
if ids: if ids:
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
if obj.date: if obj.date_from:
date=obj.date date_from=obj.date_from
if obj.date_to:
date_to=obj.date_to
if obj.cycle_id: if obj.cycle_id:
dom.append([ dom.append([
'cycle_id','=',obj.cycle_id.id, 'cycle_id','=',obj.cycle_id.id,
@ -55,8 +56,8 @@ class HDReportDialy(Model):
dom.append([ dom.append([
'doctor_id','=',obj.doctor_id.id, 'doctor_id','=',obj.doctor_id.id,
]) ])
dom.append(['time_start', ">=", date+" 00:00:00"]) dom.append(['time_start', ">=", date_from+" 00:00:00"])
dom.append(['time_stop',"<=", date+" 23:59:59"]) dom.append(['time_stop',"<=", date_to+" 23:59:59"])
lines=[] lines=[]
cycles=[] cycles=[]
@ -72,7 +73,6 @@ class HDReportDialy(Model):
if not cycle_name in cycles: if not cycle_name in cycles:
cycles.append(cycle_name) cycles.append(cycle_name)
show_cycle=True show_cycle=True
print("OK")
vals={ vals={
'color': 'success', 'color': 'success',
'show_cycle': False, 'show_cycle': False,
@ -125,7 +125,10 @@ class HDReportDialy(Model):
del lines[0] del lines[0]
data={ data={
'lines': lines, 'lines': lines,
'same_date': date_from==date_to,
'date_from': date_from,
'date_to': date_to,
} }
return data return data
HDReportDialy.register() ReportHDDialy.register()

View File

@ -4,9 +4,9 @@ from calendar import monthrange
from netforce.model import Model, fields, get_model from netforce.model import Model, fields, get_model
class HDReportMonth(Model): class ReportHDMonthly(Model):
_name="clinic.hd.report.monthly" _name="clinic.report.hd.monthly"
_string="Summary of the Hemodialysis" _string="Report HD Monthly"
_transient=True _transient=True
_fields={ _fields={
@ -49,4 +49,4 @@ class HDReportMonth(Model):
return data return data
HDReportMonth.register() ReportHDMonthly.register()

View File

@ -1,9 +1,13 @@
<center> <center>
<h2>HD Case Report </h2> <h2>Summary of the Hemodialysis</h2>
<h3> <h3>Clinic [Ratchawat]</h3>
Clinic [Ratchawat]<br/> <h4>
As at {{fmt_date date}} {{#if same_date}}
</h3> As at {{fmt_date date_from}}
{{else}}
From {{fmt_date date_from}} to {{fmt_date date_to}}
{{/if}}
</h4>
</center> </center>
<table class="table table-striped"> <table class="table table-striped">
<thead class="scroll-header"> <thead class="scroll-header">
@ -45,7 +49,7 @@
{{/if}} {{/if}}
<tr class="{{color}}"> <tr class="{{color}}">
{{#if no_patient}} {{#if no_patient}}
<td>Total</td> <td><b>TOTAL</b></td>
<td>{{no_patient}}</td> <td>{{no_patient}}</td>
{{else}} {{else}}
<td></td> <td></td>