report staff

conv_bal
watcha.h 2014-12-09 07:48:27 +07:00
parent e761b955bb
commit e79317fa95
15 changed files with 43 additions and 136 deletions

View File

@ -3,6 +3,6 @@
<field name="view_cls">multi_view</field>
<field name="model">clinic.hd.case.expense</field>
<field name="tabs">[["All",[]],["Draft",[["state","=","draft"]]],["Waiting Matching",[["state","=","waiting_matching"]]],["Match",[["state","=","match"]]],["Unmatch",[["state","=","unmatch"]]],["Approved",[["state","=","approved"]]]]</field>
<field name="menu">clinic_menu</field>
<field name="menu">account_menu</field>
<field name="limit">50</field>
</action>

View File

@ -1,8 +1,8 @@
<action>
<field name="string">Report Nurse Fee Detail</field>
<field name="string">Report Staff 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="model">clinic.report.staff.fee.detail</field>
<field name="report_template">report_staff_fee_detail</field>
<field name="report_template_xls">report_staff_fee_detail</field>
<field name="menu">account_menu</field>
</action>

View File

@ -1,8 +1,8 @@
<action>
<field name="string">Report Nurse Fee Summary</field>
<field name="string">Report Staff 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="model">clinic.report.staff.fee.sum</field>
<field name="report_template">report_staff_fee_sum</field>
<field name="report_template_xls">report_staff_fee_sum</field>
<field name="menu">account_menu</field>
</action>

View File

@ -42,7 +42,6 @@
</item>
<item string="HD Cases">
<item string="HD Cases" action="clinic_hd_case"/>
<item string="HD Case Expense" action="clinic_hd_case_expense"/>
<divider/>
<header string="REPORTS"/>
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>

View File

@ -4,11 +4,12 @@
<item string="Labor Cost" action="clinic_labor_cost"/>
<item string="Labor Cost Items" action="clinic_labor_cost_item"/>
<item string="Import Payment" action="import_clinic_payment"/>
<item string="HD Case Expense" action="clinic_hd_case_expense"/>
<divider/>
<header string="REPORTS"/>
<item string="Cost By Period" action="clinic_labor_cost"/>
<item string="Nurse Fee Summary" action="clinic_report_nurse_fee_sum"/>
<item string="Nurse Fee Detail" action="clinic_report_nurse_fee_detail"/>
<item string="Staff Fee Summary" action="clinic_report_staff_fee_sum"/>
<item string="Staff Fee Detail" action="clinic_report_staff_fee_detail"/>
</item>
</item>
</inherit>

View File

@ -1,4 +1,4 @@
<form model="clinic.report.nurse.fee.detail">
<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"/>

View File

@ -1,6 +1,7 @@
<form model="clinic.report.nurse.fee.sum">
<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="nurse_id" span="3"/>
<field name="staff_id" span="3"/>
<field name="type" span="3"/>
</form>

View File

@ -58,8 +58,8 @@ 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
from . import report_staff_fee_sum
from . import report_staff_fee_detail
from . import branch
from . import period
from . import period_line

View File

@ -6,9 +6,9 @@ from netforce.access import get_active_company
from . import utils
class ReportNurseFeeDetail(Model):
_name="clinic.report.nurse.fee.detail"
_string="Report Nurse Fee Summary"
class ReportStaffFeeDetail(Model):
_name="clinic.report.staff.fee.detail"
_string="Report Staff Fee Summary"
_transient=True
_fields={
@ -65,7 +65,7 @@ class ReportNurseFeeDetail(Model):
staff=get_model("clinic.staff").browse(staff_id)
staff_name=staff.name
dom.append(['staff_id','=',staff.id])
dlines=get_model('clinic.cycle.daily.line').search_browse(dom)
dlines=get_model('clinic.labor.cost.line').search_browse(dom)
# group by date
all_vals={}
for dline in dlines:
@ -132,4 +132,4 @@ class ReportNurseFeeDetail(Model):
data['date_to']="%s-%s-%s"%(year,month,total_day)
return data
ReportNurseFeeDetail.register()
ReportStaffFeeDetail.register()

View File

@ -8,16 +8,17 @@ from netforce.access import get_active_company
from . import utils
class ReportNurseFeeSum(Model):
_name="clinic.report.nurse.fee.sum"
_string="Report Nurse Fee Summary"
class ReportStaffFeeSum(Model):
_name="clinic.report.staff.fee.sum"
_string="Report Staff Fee Summary"
_transient=True
_fields={
"date": fields.Date("Month"),
"date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True),
"nurse_id": fields.Many2One("clinic.staff","Nurse", domain=[['type','=','nurse']]),
"staff_id": fields.Many2One("clinic.staff","Staff"),
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
}
def _get_date_from(self,context={}):
@ -33,6 +34,7 @@ class ReportNurseFeeSum(Model):
'date': lambda *a: time.strftime("%Y-%m-%d"),
'date_from': _get_date_from,
'date_to': _get_date_to,
'type': 'nurse',
}
def get_report_data(self,ids,context={}):
@ -48,10 +50,12 @@ class ReportNurseFeeSum(Model):
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)
nurse_id=None
staff_id=None
staff_type="nurse"
if ids:
obj=self.browse(ids)[0]
nurse_id=obj.nurse_id.id
staff_type=obj.type
staff_id=obj.staff_id.id
month=obj.date_from.split("-")[1]
time_start=obj.date_from
time_stop=obj.date_to
@ -74,16 +78,14 @@ class ReportNurseFeeSum(Model):
total_all={}
total_sum=0.0
dom=[]
dom.append(['type','=','nurse'])
for nurse in get_model("clinic.staff").search_browse(dom):
if nurse_id:
if nurse_id!=nurse.id:
dom.append(['type','=',staff_type])
for staff in get_model("clinic.staff").search_browse(dom):
if staff_id:
if staff_id!=staff.id:
continue
#level=nurse.level_id
#level_name=level and level.name or ""
line={
'nurse_id': nurse.id,
'nurse_name': '%s'%(nurse.name),
'staff_id': staff.id,
'staff_name': '%s'%(staff.name),
'sub_lines': [],
}
total_amt=0.0
@ -92,16 +94,13 @@ class ReportNurseFeeSum(Model):
total_all[date]=0.0
dom=[]
dom.append(['date','=',date])
dom.append(['staff_id','=',nurse.id])
dom.append(['staff_id','=',staff.id])
amt=0
results=get_model("clinic.cycle.daily.line").search_read(dom,['amount','cycle_daily_id'])
cycle_daily_id=None
results=get_model("clinic.labor.cost.line").search_read(dom,['amount'])
if results:
for result in results:
amt+=result['amount'] or 0.0
cycle_daily_id=result['cycle_daily_id'][0]
line['sub_lines'].append({
'cycle_daily_id': cycle_daily_id,
'amt': amt,
'last': False,
})
@ -151,4 +150,4 @@ class ReportNurseFeeSum(Model):
data['date_to']="%s-%s-%s"%(year,month,total_day)
return data
ReportNurseFeeSum.register()
ReportStaffFeeSum.register()

View File

@ -1,93 +0,0 @@
<center>
<h2>
ใบสรุปการทำ Hemodialysis
</h2>
<h3>
{{parent_company_name}}&nbsp;{{company_name}}<br/>
</h3>
<h4>
ประจำเดือน {{month}} {{year}}
</h4>
</center>
<table class="table">
<thead class="scroll-header">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</thead>
<tbody>
{{#each lines}}
<tr>
<td>{{topic}}</td>
<td>{{month}}</td>
<td>เท่ากับ</td>
{{#if link}}
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_case_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}" >{{amount}}</a></td>
{{else}}
<td>{{amount}}</td>
{{/if}}
<td>{{unit}}</td>
</tr>
{{/each}}
</tbody>
</table>
<table class="table">
<tr>
<td style="width:50%">
<table class="table">
<thead>
<th><h4>รายชื่อผู้ป่วยรับใหม่</h4></th>
</thead>
<tbody>
{{#each new_patient_lines}}
<tr>
<td>{{no}}. {{name}} {{note}}</td>
</tr>
{{/each}}
</tbody>
<tfoot>
</tfoot>
</table>
</td>
<td>
<table class="table">
<thead>
<th><h4>รวมจำนวนยาที่ใช้ประจำเดือน</h4></th>
<th></th>
<th></th>
<th></th>
</thead>
<tbody>
<tr>
<td><b>ปกส.</b></td>
<td><b>uc</b></td>
<td><b>ซื้อ</b></td>
<td><b>รวม</b></td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</td>
</tr>
<tr>
<td>
<table class="table">
<thead>
<th><h4>รายชื่อผู้ป่วยจำหน่าย<h4></th>
</thead>
<tbody>
{{#each resign_patient_lines}}
<tr>
<td>{{no}}. {{name}} {{note}}</td>
</tr>
{{/each}}
</tbody>
<tfoot>
</tfoot>
</table>
</td>
</tr>
</table>

View File

@ -23,7 +23,7 @@
<tbody>
{{#each lines}}
<tr>
<td style="text-align:left;" class="col-sm-3">{{nurse_name}}</td>
<td style="text-align:left;" class="col-sm-3">{{staff_name}}</td>
{{#each sub_lines}}
{{#if last}}
<td style="text-align:right"><b>{{amt}}</b></td>