conv_bal
watcha.h 2014-10-22 10:46:15 +07:00
commit 6e60cc1a04
16 changed files with 88 additions and 165 deletions

View File

@ -28,6 +28,7 @@
<item string="Settings">
<item string="Cycles" action="clinic_cycle"/>
<item string="Departments" action="clinic_department"/>
<item string="Translate" action="clinic_translate"/>
<item string="Clinic Settings" action="clinic_setting"/>
</item>
</menu>

View File

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

View File

@ -1,4 +1,4 @@
<form model="clinic.translate">
<field name="original_string"/>
<field name="translate"/>
<field name="org"/>
<field name="tr"/>
</form>

View File

@ -1,4 +1,4 @@
<list model="clinic.translate">
<field name="original_string"/>
<field name="translate"/>
<field name="org"/>
<field name="tr"/>
</list>

View File

@ -36,3 +36,4 @@ from . import fin_setting
from . import import_data_mg
from . import import_data_nhso
from . import import_data_sc
from . import translate

View File

@ -1,27 +0,0 @@
from netforce.model import Model, fields
class ClinicRound(Model):
_name="clinic.round"
_string="Round"
_fields={
"name": fields.Char("Name",required=True,search=True),
}
def get_data(self,context={}):
lines=[]
for i in range(10):
line={
'no': i,
'doctor': 'Doctor %s'%i,
#......
}
lines.append(line)
data={
'lines': lines,
}
print('data ', data)
return data
ClinicRound.register()

View File

@ -356,7 +356,7 @@ class HDcase(Model):
# XXX
if obj.fee_partner_id.account_receivable_id:
account_id=obj.fee_partner_id.account_receivable_id.id or account_receivable_id
if not account_receivable_id:
if not account_id:
raise Exception("%s not found account recievable %s"%obj.fee_partner_id.name)
for line in obj.gm_lines:
prod=line.product_id

View File

@ -1,6 +1,7 @@
import time
from netforce.model import Model, fields, get_model
#from netforce.access import get_active_company
class ReportHDDetail(Model):
_name="clinic.report.hd.detail"
@ -25,10 +26,16 @@ class ReportHDDetail(Model):
def get_report_data(self,ids,context={}):
# company_id=get_active_company
# comp=get_model("company").browse(company_id)
# context=> dict
# inside context => keys => defaults => type => dict
# dict => key: value => '', 1, [], {}
# context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
for item in get_model("company").search_browse([]):
company_name=item.name
date_from=time.strftime("%Y-%m-%d")
date_to=time.strftime("%Y-%m-%d")
# print('date_from ',date_from)
@ -149,6 +156,7 @@ class ReportHDDetail(Model):
'same_date': date_from==date_to,
'date_from': date_from,
'date_to': date_to,
'company_name': company_name,
}
return data

View File

@ -2,7 +2,7 @@ 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 ReportHDMadical(Model):
_name="clinic.report.hd.madical"
@ -18,6 +18,10 @@ class ReportHDMadical(Model):
}
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:
@ -147,6 +151,7 @@ class ReportHDMadical(Model):
'month': month_str,
'year': year,
'lines': lines,
'company_name': company_name,
}
return data

View File

@ -3,6 +3,7 @@ import time
from datetime import datetime
from calendar import monthrange
from netforce.model import Model, fields, get_model
#from netforce.access import get_active_company
class ReportHDSummary(Model):
_name="clinic.report.hd.summary"
@ -14,10 +15,16 @@ class ReportHDSummary(Model):
}
_defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"),
'date': lambda *a: time.strftime("%Y-%m-%d"),
}
def get_report_data(self,ids,context={}):
# company_id=get_active_company
# company_name=get_model("company").search("name")
# company_name=get_model("company").search_browse()
for item in get_model("company").search_browse([]):
company_name=item.name
date=datetime.now().strftime("%Y-%m-%d")
dom=[]
if ids:
@ -40,22 +47,30 @@ class ReportHDSummary(Model):
previous_month = 12
#tip previous_month=str(month-1 == 0 and 12 or month)
previous_month_str=datetime.strptime('%s'%previous_month,'%m').strftime("%B")
time_start='2014-%s-01'%(month) # 2014-10-20
time_stop='2014-%s-%s'%(month,total_day)
dom=[]
dom.append(['time_start','>=',time_start])
dom.append(['time_stop','<=',time_stop])
patients=get_model("clinic.patient").search_browse(['type','=','All'])
new_patients=len(patients)
patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
patients_sc=get_model("clinic.patient").search_browse(['type','=','sc'])
patients_nhso=get_model("clinic.patient").search_browse(['type','=','nhso'])
patients_pn=get_model("clinic.patient").search_browse(['type','=','personal'])
dom=[]
dom.append(['type','=','mg'])
patients_mg=len(get_model("clinic.patient").search(dom))
dom.append(['type','=','sc'])
patients_sc=len(get_model("clinic.patient").search(dom))
dom.append(['type','=','nhso'])
patients_nhso=len(get_model("clinic.patient").search(dom))
dom.append(['type','=','nhso'])
patients_nhso=len(get_model("clinic.patient").search(dom))
dom.append(['type','=','pn'])
patients_pn=len(get_model("clinic.patient").search(dom))
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
#new_patients=len(patients)
dom=[]
dom.append(['state','=','completed'])
dom.append(['time_start','>=',time_start])
@ -66,84 +81,91 @@ class ReportHDSummary(Model):
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
time_stop_pre='2014-%s-%s'%(previous_month,prev_total_day)
dom=[]
dom=[]
dom.append(['state','=','completed'])
dom.append(['time_start','>=',time_start_pre])
dom.append(['time_stop','<=',time_stop_pre])
prev_total_case=len(get_model("clinic.hd.case").search(dom))
lines=[
{
'topic': 'The number of times the Hemodialysis',
items={
'topic1': {
'month': month_str,
'amount': cur_total_case,
'date_from': time_start,
'date_to': time_stop,
},
'topic2':
{
'topic':'The number of cases brought',
'month': previous_month_str,
'amount': prev_total_case,
'date_from': time_start_pre,
'date_to': time_stop_pre,
},
'topic3':
{
'topic':'Number of new patients',
'month': month_str,
'amount': new_patients,
'amount': patients,
'date_from': time_start,
'date_to': time_stop,
},
'topic4':
{
'topic':'Number of patients discharged',
'month': month_str,
'amount': 'N/A',
'date_from': time_start,
'date_to': time_stop,
},
'topic5':
{
'topic':'The number of cases brought',
'month': next_month_str,
'amount': 'N/A',
'date_from': time_start,
'date_to': time_stop,
},
'topic6':
{
'topic':'Number of patients withdrawn Social Security',
'month': '',
'amount': len(patients_sc),
'date_from': "",
'date_to': "",
'amount': patients_sc,
'date_from': time_start,
'date_to': time_stop,
},
'topic7':
{
'topic':'Number of patients withdrawn Medical Government',
'month':'',
'amount': len(patients_mg),
'date_from': "",
'date_to': "",
'amount': patients_mg,
'date_from': time_start,
'date_to': time_stop,
},
'topic8':
{
'topic':'Number of patients withdrawn NHSO(30B)',
'month':'',
'amount': len(patients_nhso),
'date_from': "",
'date_to': "",
'amount': patients_nhso,
'date_from': time_start,
'date_to': time_stop,
},
'topic9':
{
'topic':'Many patients pay themselves',
'month': '',
'amount': len(patients_pn),
'date_from': "",
'date_to': "",
'amount': patients_pn,
'date_from': time_start,
'date_to': time_stop,
},
]
}
lines=[]
for item in get_model("clinic.translate").search_browse([]):
topic=item.org
line=items.get(topic,{})
line['topic']=item.tr
lines.append(line)
data={
'month': month_str,
'year': year,
'lines': lines,
'company_name': company_name,
}
#print("data", data)
print("data", data)
return data
ReportHDSummary.register()

View File

@ -3,10 +3,10 @@ from netforce.model import Model, fields
class Translate(Model):
_name="clinic.translate"
_string="Translate"
_field_name="org"
_fields={
"original_string": fields.Char("original_string","Original String",required=True,search=True),
"translate": fields.Char("translate","Translate"),
"org": fields.Char("Original String",required=True,search=True),
"tr": fields.Char("Translate"),
}

View File

@ -1,6 +1,6 @@
<center>
<h2>Detail of the Hemodialysis</h2>
<h3>Clinic [Ratchawat]</h3>
<h3>[{{company_name}}]</h3>
<h4>
{{#if same_date}}
As at {{fmt_date date_from}}

View File

@ -1,84 +0,0 @@
<center>
<h2>Summary of the Hemodialysis</h2>
<h3>Clinic [Ratchawat]</h3>
<h4>
{{#if same_date}}
As at {{fmt_date date_from}}
{{else}}
From {{fmt_date date_from}} to {{fmt_date date_to}}
{{/if}}
</h4>
</center>
<table class="table table-striped">
<thead class="scroll-header">
<tr>
<th>
Cycle
</th>
<th>
Patient
</th>
<th>
Doctor
</th>
<th>
Patient Type
</th>
<th>
HD Fee
</th>
<th>
RC.No
</th>
<th>
Dialyzer
</th>
<th>
Nurse
</th>
</tr>
</thead>
<tbody>
{{#each lines context=context}}
{{#if show_cycle}}
<tr>
<td colspan="10" style="font-weight:bold">
{{cycle}}
</td>
</tr>
{{/if}}
<tr class="{{color}}">
{{#if no_patient}}
<td><b>TOTAL</b></td>
<td>{{no_patient}}</td>
{{else}}
<td></td>
<td>{{patient}}</td>
{{/if}}
<td>
{{doctor}}
</td>
<td>
{{patient_type}}
</td>
<td>
{{total}}
</td>
<td>
{{rc_no}}
</td>
<td>
{{dialyzer_name}}
</td>
<td>
{{nurse}}
</td>
</tr>
{{/each}}
</tbody>
<tfoot>
<tr style="font-weight:bold">
</tr>
</tfoot>
</table>

View File

@ -3,7 +3,7 @@
Summary of the Madical
</h2>
<h3>
[Ratchawat : Saamsan4]<br/>
[{{company_name}}]<br/>
As at {{month}} {{year}}
</h3>
</center>

View File

@ -3,7 +3,7 @@
Summary of the Hemodialysis
</h2>
<h3>
[Ratchawat : Saamsan4]<br/>
[{{company_name}}]<br/>
As at {{month}} {{year}}
</h3>
</center>