report nurse fee
parent
1a542dd360
commit
61aac38445
|
@ -0,0 +1,8 @@
|
|||
<action>
|
||||
<field name="string">Report Nurse Fee Detail</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.nurse.fee.detail</field>
|
||||
<field name="report_template">report_nurse_fee_detail</field>
|
||||
<field name="report_template_xls">report_nurse_fee_detail</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -0,0 +1,8 @@
|
|||
<action>
|
||||
<field name="string">Report Nurse Fee Summary</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.nurse.fee.sum</field>
|
||||
<field name="report_template">report_nurse_fee_sum</field>
|
||||
<field name="report_template_xls">report_nurse_fee_sum</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
|
@ -49,9 +49,9 @@
|
|||
<item string="Discontinue Patient" action="clinic_report_discontinue_patient"/>
|
||||
<divider/>
|
||||
<header string="LABOR COST"/>
|
||||
<item string="Nurse Fee Summary" action="clinic_report_nurse_free_sum"/>
|
||||
<item string="Nurse Fee Detail" action="clinic_report_nurse_free_detail"/>
|
||||
<item string="Special Nurse" action="clinic_report_nurse_free_detail"/>
|
||||
<item string="Nurse Fee Summary" action="clinic_report_nurse_fee_sum"/>
|
||||
<item string="Nurse Fee Detail" action="clinic_report_nurse_fee_detail"/>
|
||||
<item string="Special Nurse" action="clinic_report_nurse_fee_detail"/>
|
||||
</item>
|
||||
<item string="Settings">
|
||||
<item string="Departments" action="clinic_department"/>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<form model="clinic.report.nurse.fee.detail">
|
||||
<field name="date" span="3" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="3"/>
|
||||
<field name="date_to" span="3"/>
|
||||
<field name="personal_id" span="3"/>
|
||||
</form>
|
|
@ -0,0 +1,5 @@
|
|||
<form model="clinic.report.nurse.fee.sum">
|
||||
<field name="date" span="3" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="3"/>
|
||||
<field name="date_to" span="3"/>
|
||||
</form>
|
|
@ -36,11 +36,6 @@ from . import cycle_dialy
|
|||
from . import cycle_dialy_line
|
||||
from . import gen_visit
|
||||
from . import gen_visit_line
|
||||
from . import report_clinic
|
||||
from . import report_hd_case_summary
|
||||
from . import report_medical_summary
|
||||
from . import report_recent_patient
|
||||
from . import report_discontinue_patient
|
||||
from . import fin_setting
|
||||
from . import import_data_mg
|
||||
from . import import_data_nhso
|
||||
|
@ -58,3 +53,10 @@ from . import schedule_line
|
|||
from . import schedule_copy
|
||||
from . import load_nurse
|
||||
from . import load_nurse_line
|
||||
from . import report_clinic
|
||||
from . import report_hd_case_summary
|
||||
from . import report_medical_summary
|
||||
from . import report_recent_patient
|
||||
from . import report_discontinue_patient
|
||||
from . import report_nurse_fee_sum
|
||||
from . import report_nurse_fee_detail
|
||||
|
|
|
@ -15,6 +15,7 @@ class CycleDialyLine(Model):
|
|||
'amount': fields.Float("Amount"),
|
||||
'company_id': fields.Many2One("company","Company"),
|
||||
"type": fields.Selection([("doctor","Doctor"),('nurse','Nurse'),("personal","Personal")],"Type",required=True),
|
||||
'date': fields.Date("Date"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
|
|
@ -208,6 +208,7 @@ class CycleItem(Model):
|
|||
line={
|
||||
'cycle_id': cycle_id,
|
||||
'personal_id': personal_id,
|
||||
'date': obj.date,
|
||||
}
|
||||
line.update(vals)
|
||||
lines.append(('create',line))
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
import time
|
||||
from calendar import monthrange
|
||||
|
||||
from netforce.model import Model,fields,get_model
|
||||
from netforce.access import get_active_company
|
||||
|
||||
from . import utils
|
||||
|
||||
class ReportNurseFeeDetail(Model):
|
||||
_name="clinic.report.nurse.fee.detail"
|
||||
_string="Report Nurse Fee Summary"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Month"),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
"date_to": fields.Date("To", required=True),
|
||||
'personal_id': fields.Many2One("clinic.personal","Personal"),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
year,month=time.strftime("%Y-%m").split("-")
|
||||
return '%s-%s-01'%(year,month)
|
||||
|
||||
def _get_date_to(self,context={}):
|
||||
year,month,day=time.strftime("%Y-%m-%d").split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
return "%s-%s-%s"%(year,month,total_day)
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_from': _get_date_from,
|
||||
'date_to': _get_date_to,
|
||||
}
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
time_start='%s-%s-01'%(year,str(month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
|
||||
defaults=context.get('defaults')
|
||||
if defaults:
|
||||
year,month,day=defaults['date'].split("-")
|
||||
time_start='%s-%s-01'%(year,str(month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
personal_id=None
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
month=obj.date_from.split("-")[1]
|
||||
time_start=obj.date_from
|
||||
time_stop=obj.date_to
|
||||
personal_id=obj.personal_id.id
|
||||
# new patient of this month
|
||||
dom=[]
|
||||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
personal_name=''
|
||||
if personal_id:
|
||||
personal=get_model("clinic.personal").browse(personal_id)
|
||||
personal_name=personal.name
|
||||
dom.append(['personal_id','=',personal.id])
|
||||
records=get_model('clinic.cycle.dialy.line').search_browse(dom)
|
||||
# group by date
|
||||
all_vals={}
|
||||
for record in records:
|
||||
#date=''
|
||||
#if record.date:
|
||||
#date=record.date[8:10]
|
||||
date=record.date
|
||||
personal_id=record.personal_id.id
|
||||
key=(date,personal_id)
|
||||
if key not in all_vals.keys():
|
||||
all_vals[key]={
|
||||
'qty': 0,
|
||||
'amount': 0,
|
||||
}
|
||||
all_vals[key]['qty']+=record.qty or 0
|
||||
all_vals[key]['amount']+=record.amount or 0
|
||||
|
||||
lines=[]
|
||||
total_amount=0.0
|
||||
total_qty=0.0
|
||||
for key,vals in all_vals.items():
|
||||
date,personal_id=key
|
||||
qty=vals['qty'] or 0
|
||||
amount=vals['amount'] or 0
|
||||
lines.append({
|
||||
'date': date,
|
||||
'qty': qty,
|
||||
'amount': amount or 0.0,
|
||||
})
|
||||
total_qty+=qty
|
||||
total_amount+=amount
|
||||
|
||||
month_str=utils.MONTHS['th_TH'][int(month)]
|
||||
start=int(time_start[8:10])
|
||||
stop=int(time_stop[8:10])
|
||||
diff=stop-start
|
||||
data={
|
||||
'company_name': company.name or "",
|
||||
'parent_company_name': company.parent_id.name or "",
|
||||
'personal_name': personal_name,
|
||||
'lines': lines,
|
||||
'total_qty': total_qty,
|
||||
'total_amount': total_amount,
|
||||
'month': month_str,
|
||||
'from': time_start,
|
||||
'to': time_stop,
|
||||
'is_duration': diff+1 < total_day,
|
||||
'year': year,
|
||||
}
|
||||
return data
|
||||
|
||||
def onchange_date(self,context={}):
|
||||
data=context['data']
|
||||
date=data['date']
|
||||
year,month,day=date.split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
data['date_from']="%s-%s-01"%(year,month)
|
||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||
return data
|
||||
|
||||
ReportNurseFeeDetail.register()
|
|
@ -0,0 +1,96 @@
|
|||
import time
|
||||
from calendar import monthrange
|
||||
|
||||
from netforce.model import Model,fields,get_model
|
||||
from netforce.access import get_active_company
|
||||
|
||||
from . import utils
|
||||
|
||||
class ReportNurseFeeSum(Model):
|
||||
_name="clinic.report.nurse.fee.sum"
|
||||
_string="Report Nurse Fee Summary"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Month"),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
"date_to": fields.Date("To", required=True),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
year,month=time.strftime("%Y-%m").split("-")
|
||||
return '%s-%s-01'%(year,month)
|
||||
|
||||
def _get_date_to(self,context={}):
|
||||
year,month,day=time.strftime("%Y-%m-%d").split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
return "%s-%s-%s"%(year,month,total_day)
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
'date_from': _get_date_from,
|
||||
'date_to': _get_date_to,
|
||||
}
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
company_id=get_active_company()
|
||||
company=get_model('company').browse(company_id)
|
||||
year, month=time.strftime("%Y-%m").split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
time_start='%s-%s-01'%(year,str(month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
|
||||
defaults=context.get('defaults')
|
||||
if defaults:
|
||||
year,month,day=defaults['date'].split("-")
|
||||
time_start='%s-%s-01'%(year,str(month).zfill(2))
|
||||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
month=obj.date_from.split("-")[1]
|
||||
time_start=obj.date_from
|
||||
time_stop=obj.date_to
|
||||
# new patient of this month
|
||||
dom=[]
|
||||
dom.append(['resign_date','>=',time_start])
|
||||
dom.append(['resign_date','<=',time_stop])
|
||||
dom.append(['active','=',False])
|
||||
records=get_model('clinic.patient').search_browse(dom)
|
||||
lines=[]
|
||||
no=1
|
||||
for record in records:
|
||||
lines.append({
|
||||
'no': no,
|
||||
'name': record.name or '',
|
||||
'pid': record.id,
|
||||
'note': record.note or '',
|
||||
'resign_date': record.resign_date or '',
|
||||
})
|
||||
no+=1
|
||||
|
||||
month_str=utils.MONTHS['th_TH'][int(month)]
|
||||
start=int(time_start[8:10])
|
||||
stop=int(time_stop[8:10])
|
||||
diff=stop-start
|
||||
data={
|
||||
'company_name': company.name or "",
|
||||
'parent_company_name': company.parent_id.name or "",
|
||||
'lines': lines,
|
||||
'month': month_str,
|
||||
'from': time_start,
|
||||
'to': time_stop,
|
||||
'is_duration': diff+1 < total_day,
|
||||
'year': year,
|
||||
}
|
||||
return data
|
||||
|
||||
def onchange_date(self,context={}):
|
||||
data=context['data']
|
||||
date=data['date']
|
||||
year,month,day=date.split("-")
|
||||
weekday, total_day=monthrange(int(year), int(month))
|
||||
data['date_from']="%s-%s-01"%(year,month)
|
||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||
return data
|
||||
|
||||
ReportNurseFeeSum.register()
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,41 @@
|
|||
<center>
|
||||
<h2>ผลตอบแทนดูแลผู้ป่วย</h2>
|
||||
<h3>
|
||||
{{parent_company_name}} {{company_name}}<br/>
|
||||
</h3>
|
||||
<h4>
|
||||
{{personal_name}}
|
||||
</h4>
|
||||
<h4>
|
||||
{{#if is_duration}}
|
||||
ระหว่างวันที่ {{from}} ถึง {{to}}
|
||||
{{else}}
|
||||
ประจำเดือน {{month}} {{year}}
|
||||
{{/if}}
|
||||
</h4>
|
||||
</center>
|
||||
{{#if lines}}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>วันที่</th>
|
||||
<th>จำนวนคนไข้</th>
|
||||
<th>จำนวนเงิน</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each lines}}
|
||||
<tr>
|
||||
<td>{{date}}</td>
|
||||
<td>{{qty}}</td>
|
||||
<td>{{currency amount}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<th>TOTAL</th>
|
||||
<th>{{total_qty}}</th>
|
||||
<th>{{currency total_amount}}</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
{{else}}
|
||||
No items to display.
|
||||
{{/if}}
|
|
@ -0,0 +1,39 @@
|
|||
<center>
|
||||
<h2>สรุปค่าธรรมเนียมพยาบาล</h2>
|
||||
<h3>
|
||||
{{parent_company_name}} {{company_name}}<br/>
|
||||
</h3>
|
||||
<h4>
|
||||
{{#if is_duration}}
|
||||
ระหว่างวันที่ {{from}} ถึง {{to}}
|
||||
{{else}}
|
||||
ประจำเดือน {{month}} {{year}}
|
||||
{{/if}}
|
||||
</h4>
|
||||
</center>
|
||||
{{#if lines}}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>วันที่</th>
|
||||
<th>ชื่อ</th>
|
||||
<th>หมายเหตุ</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each lines}}
|
||||
<tr>
|
||||
<td>{{no}}</td>
|
||||
<td>{{resign_date}}</td>
|
||||
<td>
|
||||
{{view "link" string=name action="clinic_patient" action_options="mode=form" active_id=pid}}
|
||||
</td>
|
||||
<td>{{note}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
{{else}}
|
||||
No items to display.
|
||||
{{/if}}
|
|
@ -1,4 +1,7 @@
|
|||
=======
|
||||
- define rule to get
|
||||
- fee product
|
||||
- invoice
|
||||
- add picture of patient to visit/hd case dialy
|
||||
- cycle dialy
|
||||
- lines
|
||||
|
|
Loading…
Reference in New Issue