report staff (80%)
parent
8c14f45d8b
commit
f9042fb5f4
|
@ -0,0 +1,8 @@
|
|||
<action>
|
||||
<field name="string">Staff Fee</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.staff.fee</field>
|
||||
<field name="report_template">report_staff_fee</field>
|
||||
<field name="report_template_xls">report_staff_fee</field>
|
||||
<field name="menu">account_menu</field>
|
||||
</action>
|
|
@ -1,5 +1,5 @@
|
|||
<action>
|
||||
<field name="string">Report Staff Fee Detail</field>
|
||||
<field name="string">Staff Fee Detail</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.staff.fee.detail</field>
|
||||
<field name="report_template">report_staff_fee_detail</field>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<action>
|
||||
<field name="string">Report Staff Fee Summary</field>
|
||||
<field name="string">Staff Fee Summary</field>
|
||||
<field name="view_cls">report</field>
|
||||
<field name="model">clinic.report.staff.fee.sum</field>
|
||||
<field name="report_template">report_staff_fee_sum</field>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<list model="clinic.cycle.item" colors='{"#9f9":[["state","=","validated"]]}'>
|
||||
<head>
|
||||
<button string="Validate" method="validate_all" type="success" perm="clinic_cycle_item_validate_all"/>
|
||||
</head>
|
||||
<field name="cycle_id"/>
|
||||
<field name="date"/>
|
||||
<field name="department_id"/>
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
</field>
|
||||
<field name="total_dcost" span="3" offset="9"/>
|
||||
</tab>
|
||||
<tab string="Others">
|
||||
<tab string="Other Staff">
|
||||
<field name="staff_lines" nolabel="1">
|
||||
<list>
|
||||
<field name="cycle_id"/>
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
<item string="HD Case Expenses" action="clinic_hd_case_expense"/>
|
||||
<divider/>
|
||||
<header string="REPORTS"/>
|
||||
<item string="Staff Fee Summary" action="clinic_report_staff_fee_sum"/>
|
||||
<item string="Staff Fee" action="clinic_report_staff_fee"/>
|
||||
<item string="Staff Fee Detail" action="clinic_report_staff_fee_detail"/>
|
||||
<item string="Staff Fee Summary" action="clinic_report_staff_fee_sum"/>
|
||||
<divider/>
|
||||
<header string="OTHERS"/>
|
||||
<item string="Clinic Settings" action="clinic_account_setting"/>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<form model="clinic.report.staff.fee">
|
||||
<field name="date" span="2" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="2"/>
|
||||
<field name="date_to" span="2"/>
|
||||
<field name="staff_id" span="2"/>
|
||||
<field name="type" span="2"/>
|
||||
<field name="department_id" span="2"/>
|
||||
<field name="branch_id" span="2"/>
|
||||
</form>
|
|
@ -1,7 +1,9 @@
|
|||
<form model="clinic.report.staff.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="staff_id" span="3"/>
|
||||
<field name="type" span="3"/>
|
||||
<field name="date" span="2" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="2"/>
|
||||
<field name="date_to" span="2"/>
|
||||
<field name="staff_id" span="2"/>
|
||||
<field name="type" span="2"/>
|
||||
<field name="department_id" span="2"/>
|
||||
<field name="branch_id" span="2"/>
|
||||
</form>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<form model="clinic.report.staff.fee.sum">
|
||||
<field name="date" span="3" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="3"/>
|
||||
<field name="date_to" span="3"/>
|
||||
<field name="staff_id" span="3"/>
|
||||
<field name="type" span="3"/>
|
||||
<field name="date" span="2" mode="month" onchange="onchange_date"/>
|
||||
<field name="date_from" span="2"/>
|
||||
<field name="date_to" span="2"/>
|
||||
<field name="staff_id" span="2"/>
|
||||
<field name="type" span="2"/>
|
||||
<field name="department_id" span="2"/>
|
||||
<field name="branch_id" span="2"/>
|
||||
</form>
|
||||
|
|
|
@ -58,8 +58,9 @@ from . import report_hd_case_summary
|
|||
from . import report_medical_summary
|
||||
from . import report_recent_patient
|
||||
from . import report_discontinue_patient
|
||||
from . import report_staff_fee_sum
|
||||
from . import report_staff_fee
|
||||
from . import report_staff_fee_detail
|
||||
from . import report_staff_fee_sum
|
||||
from . import report_payment_matching
|
||||
from . import branch
|
||||
from . import period
|
||||
|
|
|
@ -74,6 +74,17 @@ class CycleItem(Model):
|
|||
super().write(ids,vals,**kw)
|
||||
self.function_store(ids)
|
||||
|
||||
def validate_all(self,ids,context={}):
|
||||
for obj in self.browse(ids):
|
||||
obj.validate()
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_cycle_item',
|
||||
'mode': 'list',
|
||||
},
|
||||
'flash': 'Cycle Item has been validated.',
|
||||
}
|
||||
|
||||
def validate(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
for obj_id in ids:
|
||||
|
@ -105,7 +116,7 @@ class CycleItem(Model):
|
|||
}
|
||||
|
||||
def to_draft(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
for obj in self.browse(ids):
|
||||
obj.write({
|
||||
'state': 'draft',
|
||||
})
|
||||
|
|
|
@ -55,7 +55,7 @@ class LaborCost(Model):
|
|||
return res
|
||||
|
||||
_fields={
|
||||
"cycle_item_id": fields.Many2One("clinic.cycle.item","Cycle Item",required=True),
|
||||
"cycle_item_id": fields.Many2One("clinic.cycle.item","Cycle Item",required=True,search=True),
|
||||
'var_k': fields.Float("K"),
|
||||
'var_pt': fields.Integer("PT", function="_get_all",function_multi=True),
|
||||
'var_ptx': fields.Char("PT x K:", function="_get_all",function_multi=True),
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
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 ReportStaffFee(Model):
|
||||
_name="clinic.report.staff.fee"
|
||||
_string="Report Staff Fee"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Month"),
|
||||
"date_from": fields.Date("From", required=True),
|
||||
"date_to": fields.Date("To", required=True),
|
||||
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
}
|
||||
|
||||
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)
|
||||
staff_id=None
|
||||
department_id=None
|
||||
branch_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
|
||||
staff_id=obj.staff_id.id
|
||||
department_id=obj.department_id.id
|
||||
branch_id=obj.branch_id.id
|
||||
# new patient of this month
|
||||
dom=[]
|
||||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
staff_name=''
|
||||
# TODO can filter doctor and nurse
|
||||
if staff_id:
|
||||
staff=get_model("clinic.staff").browse(staff_id)
|
||||
staff_name=staff.name
|
||||
dom.append(['staff_id','=',staff.id])
|
||||
dlines=get_model('clinic.labor.cost.line').search_browse(dom)
|
||||
|
||||
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 "",
|
||||
'staff_name': staff_name,
|
||||
'lines': sorted(lines,key=lambda x: x['date']),
|
||||
'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
|
||||
|
||||
ReportStaffFee.register()
|
|
@ -8,7 +8,7 @@ from . import utils
|
|||
|
||||
class ReportStaffFeeDetail(Model):
|
||||
_name="clinic.report.staff.fee.detail"
|
||||
_string="Report Staff Fee Summary"
|
||||
_string="Report Staff Fee Detail"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
|
@ -17,6 +17,8 @@ class ReportStaffFeeDetail(Model):
|
|||
"date_to": fields.Date("To", required=True),
|
||||
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
||||
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
|
@ -49,6 +51,8 @@ class ReportStaffFeeDetail(Model):
|
|||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
staff_id=None
|
||||
staff_type=None
|
||||
department_id=None
|
||||
branch_id=None
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
month=obj.date_from.split("-")[1]
|
||||
|
@ -56,10 +60,16 @@ class ReportStaffFeeDetail(Model):
|
|||
time_stop=obj.date_to
|
||||
staff_id=obj.staff_id.id
|
||||
staff_type=obj.type
|
||||
department_id=obj.department_id.id
|
||||
branch_id=obj.branch_id.id
|
||||
# new patient of this month
|
||||
dom=[]
|
||||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
staff_name=''
|
||||
if staff_id:
|
||||
staff=get_model("clinic.staff").browse(staff_id)
|
||||
|
|
|
@ -19,6 +19,8 @@ class ReportStaffFeeSum(Model):
|
|||
"date_to": fields.Date("To", required=True),
|
||||
"staff_id": fields.Many2One("clinic.staff","Staff"),
|
||||
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
|
||||
'department_id': fields.Many2One("clinic.department","Department"),
|
||||
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
|
@ -52,6 +54,8 @@ class ReportStaffFeeSum(Model):
|
|||
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
|
||||
staff_id=None
|
||||
staff_type="nurse"
|
||||
department_id=None
|
||||
branch_id=None
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
staff_type=obj.type
|
||||
|
@ -59,6 +63,8 @@ class ReportStaffFeeSum(Model):
|
|||
month=obj.date_from.split("-")[1]
|
||||
time_start=obj.date_from
|
||||
time_stop=obj.date_to
|
||||
department_id=obj.department_id.id
|
||||
branch_id=obj.branch_id.id
|
||||
|
||||
# generate list of date
|
||||
fmt='%Y-%m-%d'
|
||||
|
@ -79,6 +85,10 @@ class ReportStaffFeeSum(Model):
|
|||
total_sum=0.0
|
||||
dom=[]
|
||||
dom.append(['type','=',staff_type])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
for staff in get_model("clinic.staff").search_browse(dom):
|
||||
if staff_id:
|
||||
if staff_id!=staff.id:
|
||||
|
@ -139,6 +149,10 @@ class ReportStaffFeeSum(Model):
|
|||
'is_duration': diff+1 < total_day,
|
||||
'year': year,
|
||||
}
|
||||
if obj.branch_id:
|
||||
data['branch_name']='(%s)'%obj.branch_id.name or ''
|
||||
if obj.department_id:
|
||||
data['branch_name']='(%s)'%obj.department_id.name or ''
|
||||
return data
|
||||
|
||||
def onchange_date(self,context={}):
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,59 @@
|
|||
<center>
|
||||
<h2>ผลตอบแทนดูแลผู้ป่วย</h2>
|
||||
<h3>
|
||||
{{parent_company_name}} {{company_name}}<br/>
|
||||
</h3>
|
||||
<h4>
|
||||
{{staff_name}}
|
||||
</h4>
|
||||
<h4>
|
||||
{{#if is_duration}}
|
||||
ระหว่างวันที่ {{from}} ถึง {{to}}
|
||||
{{else}}
|
||||
ประจำเดือน {{month}} {{year}}
|
||||
{{/if}}
|
||||
</h4>
|
||||
</center>
|
||||
{{#if lines}}
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th>วันที่</th>
|
||||
{{#unless ../staff_name}}
|
||||
<th>บุคลากร</th>
|
||||
<th>ประเภท</th>
|
||||
{{/unless}}
|
||||
<th style="text-align:right">ชั้น</th>
|
||||
<th style="text-align:right">สาขา</th>
|
||||
<th style="text-align:right">จำนวนคนไข้</th>
|
||||
<th style="text-align:right">จำนวนเงิน</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each lines}}
|
||||
<tr>
|
||||
<td>{{date}}</td>
|
||||
{{#unless ../staff_name}}
|
||||
<td>{{staff_name}}</td>
|
||||
<td>{{staff_type}}</td>
|
||||
{{/unless}}
|
||||
<td style="text-align:right">{{dpt_name}}</td>
|
||||
<td style="text-align:right">{{branch_name}}</td>
|
||||
<td style="text-align:right">{{qty}}</td>
|
||||
<td style="text-align:right">{{currency amount}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
{{#unless ../staff_name}}
|
||||
<th></th>
|
||||
<th></th>
|
||||
{{/unless}}
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th style="text-align:right">รวม</th>
|
||||
<th style="text-align:right">{{currency total_amount}}</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
{{else}}
|
||||
No items to display.
|
||||
{{/if}}
|
|
@ -1,7 +1,7 @@
|
|||
<center>
|
||||
<h2>สรุปค่าธรรมเนียมพยาบาล</h2>
|
||||
<h3>
|
||||
{{parent_company_name}} {{company_name}}<br/>
|
||||
{{parent_company_name}} {{company_name}} {{branch_name}}<br/>
|
||||
</h3>
|
||||
<h4>
|
||||
{{#if is_duration}}
|
||||
|
|
|
@ -1,31 +1,8 @@
|
|||
todo:
|
||||
- XXXX
|
||||
- make a script to generate cycle item
|
||||
- make a sharing setting
|
||||
|
||||
- filter data
|
||||
1. company
|
||||
2. branch
|
||||
3. department
|
||||
- cycle item
|
||||
- sickedbed
|
||||
- patient
|
||||
- staff
|
||||
- script
|
||||
- after split department
|
||||
- cycle item should be see only that department
|
||||
- accounting
|
||||
- doctor detail
|
||||
- import match hn
|
||||
- visit summary -> ok
|
||||
|
||||
- calendar
|
||||
- search calendar
|
||||
- remove
|
||||
- multi company
|
||||
- running number for each branch
|
||||
- make an appoitment
|
||||
-
|
||||
- report
|
||||
- doctor labort cost detail
|
||||
- matching payment
|
||||
- popup messagging
|
||||
=======
|
||||
generate visit ใหม่ -> ok
|
||||
popup select dyalyzer -> ok
|
||||
|
|
Loading…
Reference in New Issue