rename report
							parent
							
								
									02a953edc3
								
							
						
					
					
						commit
						9803d1799a
					
				| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
<action>                                                                                                         
 | 
			
		||||
    <field name="string">Report HD Case</field>
 | 
			
		||||
    <field name="string">HD Report Dialy</field>
 | 
			
		||||
    <field name="view_cls">report</field>                                                                        
 | 
			
		||||
    <field name="model">clinic.hd.report</field>
 | 
			
		||||
    <field name="report_template">report_hd_report</field>                                                      
 | 
			
		||||
    <field name="report_template_xls">hd_report</field>                                                         
 | 
			
		||||
    <field name="model">clinic.hd.report.dialy</field>
 | 
			
		||||
    <field name="report_template">report_hd_report_dialy</field>                                                      
 | 
			
		||||
    <field name="report_template_xls">hd_report_dialy</field>                                                         
 | 
			
		||||
    <field name="menu">clinic_menu</field>                                                                      
 | 
			
		||||
</action>  
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,9 +20,7 @@
 | 
			
		|||
    <item string="Visits" action="clinic_visit"/>
 | 
			
		||||
    <item string="Treatments" action="clinic_hd_case"/>
 | 
			
		||||
    <item string="Reports">
 | 
			
		||||
        <header string="Dialyzers"/>
 | 
			
		||||
        <item string="Dialyzers Drop" action="clinic_dialyzer_report"/>
 | 
			
		||||
        <header string="HD Case"/>
 | 
			
		||||
        <header string="HD CASE"/>
 | 
			
		||||
        <item string="Daily" action="clinic_hd_report"/>
 | 
			
		||||
        <item string="Monthly" action="clinic_hd_report_monthly"/>
 | 
			
		||||
    </item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
<form model="clinic.hd.report">
 | 
			
		||||
<form model="clinic.hd.report.dialy">
 | 
			
		||||
    <group>
 | 
			
		||||
        <field name="date" span="2"/>
 | 
			
		||||
        <field name="cycle_id" span="2"/>
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,6 @@ from . import patient_cause_line
 | 
			
		|||
from . import patient_comorbidity_line
 | 
			
		||||
from . import patient_morbidity_line
 | 
			
		||||
from . import race
 | 
			
		||||
from . import report_hd
 | 
			
		||||
from . import report_dialyzer_drop
 | 
			
		||||
from . import schedule
 | 
			
		||||
from . import setting
 | 
			
		||||
| 
						 | 
				
			
			@ -31,6 +30,7 @@ from . import file_sheet
 | 
			
		|||
from . import cycle
 | 
			
		||||
from . import gen_visit
 | 
			
		||||
from . import gen_visit_line
 | 
			
		||||
from . import report_hd_dialy
 | 
			
		||||
from . import report_hd_monthly
 | 
			
		||||
from . import payment
 | 
			
		||||
from . import payment_line
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,9 +2,9 @@ import time
 | 
			
		|||
 | 
			
		||||
from netforce.model import Model, fields, get_model
 | 
			
		||||
 | 
			
		||||
class HDReport(Model):
 | 
			
		||||
    _name="clinic.hd.report"
 | 
			
		||||
    _string="HD Report"
 | 
			
		||||
class HDReportDialy(Model):
 | 
			
		||||
    _name="clinic.hd.report.dialy"
 | 
			
		||||
    _string="HD Report Dialy"
 | 
			
		||||
    _transient=True
 | 
			
		||||
    
 | 
			
		||||
    _fields={
 | 
			
		||||
| 
						 | 
				
			
			@ -128,4 +128,4 @@ class HDReport(Model):
 | 
			
		|||
        }
 | 
			
		||||
        return data
 | 
			
		||||
 | 
			
		||||
HDReport.register()
 | 
			
		||||
HDReportDialy.register()
 | 
			
		||||
| 
						 | 
				
			
			@ -18,12 +18,13 @@ class HDReportMonth(Model):
 | 
			
		|||
    }
 | 
			
		||||
    
 | 
			
		||||
    def get_report_data(self,ids,context={}):
 | 
			
		||||
        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")
 | 
			
		||||
        date=datetime.now().strftime("%Y-%m-%d")
 | 
			
		||||
        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")
 | 
			
		||||
        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)
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +34,6 @@ class HDReportMonth(Model):
 | 
			
		|||
        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',
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +42,8 @@ class HDReportMonth(Model):
 | 
			
		|||
            })
 | 
			
		||||
 | 
			
		||||
        data={
 | 
			
		||||
            'month': month_str,
 | 
			
		||||
            'year': year,
 | 
			
		||||
            'lines': lines,
 | 
			
		||||
        }
 | 
			
		||||
        return data
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
    </h2>
 | 
			
		||||
    <h3>
 | 
			
		||||
	[Ratchawat : Saamsan4]<br/>
 | 
			
		||||
        As at October 2014
 | 
			
		||||
        As at {{month}} {{year}}
 | 
			
		||||
    </h3>
 | 
			
		||||
</center>
 | 
			
		||||
<table class="table table-striped">
 | 
			
		||||
| 
						 | 
				
			
			@ -18,8 +18,7 @@
 | 
			
		|||
            <tr> 
 | 
			
		||||
                <td>{{topic}}</td>
 | 
			
		||||
                <td>{{month}}</td>
 | 
			
		||||
                <!--<td><a href="ui#name=clinic_hd_case&active_id={{contact_id}}&mode=form">{{amount}}</a></td>-->
 | 
			
		||||
                <td><a href="ui#name=clinic_hd_case&tab_no=3">{{amount}}</a></td>
 | 
			
		||||
                <td><a style="text-decoration: underline" href="ui#name=clinic_hd_case&tab_no=3">{{amount}}</a></td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {{/each}}
 | 
			
		||||
    </tbody>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue