conv_bal
watcha.h 2014-11-24 15:50:46 +07:00
parent a4683ca610
commit f007db5ecf
6 changed files with 28 additions and 7 deletions

View File

@ -2,4 +2,5 @@
<field name="date" span="3" mode="month" onchange="onchange_date"/> <field name="date" span="3" mode="month" onchange="onchange_date"/>
<field name="date_from" span="3"/> <field name="date_from" span="3"/>
<field name="date_to" span="3"/> <field name="date_to" span="3"/>
<field name="nurse_id" span="3"/>
</form> </form>

View File

@ -75,6 +75,7 @@ class ReportNurseFeeDetail(Model):
if key not in all_vals.keys(): if key not in all_vals.keys():
all_vals[key]={ all_vals[key]={
'qty': 0, 'qty': 0,
'personal_type': utils.PERSONAL_TYPE.get(personal.type,''),
'personal_name': personal.name or "", 'personal_name': personal.name or "",
'amount': 0, 'amount': 0,
} }
@ -89,9 +90,11 @@ class ReportNurseFeeDetail(Model):
qty=vals['qty'] or 0 qty=vals['qty'] or 0
amount=vals['amount'] or 0 amount=vals['amount'] or 0
_personal_name=vals['personal_name'] or '' _personal_name=vals['personal_name'] or ''
personal_type=vals['personal_type']
lines.append({ lines.append({
'date': date, 'date': date,
'qty': qty, 'qty': qty,
'personal_type': personal_type,
'personal_name': _personal_name, 'personal_name': _personal_name,
'amount': amount or 0.0, 'amount': amount or 0.0,
}) })

View File

@ -17,6 +17,7 @@ class ReportNurseFeeSum(Model):
"date": fields.Date("Month"), "date": fields.Date("Month"),
"date_from": fields.Date("From", required=True), "date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
"nurse_id": fields.Many2One("clinic.personal","Nurse", domain=[['type','=','nurse']]),
} }
def _get_date_from(self,context={}): def _get_date_from(self,context={}):
@ -47,8 +48,10 @@ class ReportNurseFeeSum(Model):
year,month,day=defaults['date'].split("-") year,month,day=defaults['date'].split("-")
time_start='%s-%s-01'%(year,str(month).zfill(2)) time_start='%s-%s-01'%(year,str(month).zfill(2))
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
nurse_id=None
if ids: if ids:
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
nurse_id=obj.nurse_id.id
month=obj.date_from.split("-")[1] month=obj.date_from.split("-")[1]
time_start=obj.date_from time_start=obj.date_from
time_stop=obj.date_to time_stop=obj.date_to
@ -70,7 +73,12 @@ class ReportNurseFeeSum(Model):
lines=[] lines=[]
total_all={} total_all={}
total_sum=0.0 total_sum=0.0
for nurse in get_model("clinic.personal").search_browse([['type','=','nurse']]): dom=[]
dom.append(['type','=','nurse'])
for nurse in get_model("clinic.personal").search_browse(dom):
if nurse_id:
if nurse_id!=nurse.id:
continue
line={ line={
'nurse_id': nurse.id, 'nurse_id': nurse.id,
'nurse_name': nurse.name or '', 'nurse_name': nurse.name or '',
@ -111,7 +119,7 @@ class ReportNurseFeeSum(Model):
'amt': total_all[date], 'amt': total_all[date],
}) })
total_lines.append({ total_lines.append({
'amt': total_sum, 'amt': round(total_sum,2),
}) })
month_str=utils.MONTHS['th_TH'][int(month)] month_str=utils.MONTHS['th_TH'][int(month)]

View File

@ -14,6 +14,12 @@ PATIENT_TYPE={
"others": "อื่นๆ", "others": "อื่นๆ",
} }
PERSONAL_TYPE={
'doctor': 'Doctor',
'nurse': 'Nurse',
'personal': 'Personal',
}
TOPICS={ TOPICS={
'topic1': {'name': 'จำนวนครั้งการทำ Hemodialysis', 'unit': 'ครั้ง'}, 'topic1': {'name': 'จำนวนครั้งการทำ Hemodialysis', 'unit': 'ครั้ง'},
'topic2': {'name': 'จำนวนผู้ป่วยยกมาจากเดือน', 'unit': 'คน'}, 'topic2': {'name': 'จำนวนผู้ป่วยยกมาจากเดือน', 'unit': 'คน'},

View File

@ -15,11 +15,12 @@
</h4> </h4>
</center> </center>
{{#if lines}} {{#if lines}}
<table class="table"> <table class="table table-condensed table-striped">
<thead> <thead>
<th>วันที่</th> <th>วันที่</th>
{{#unless ../personal_name}} {{#unless ../personal_name}}
<th>บุคลากร</th> <th>บุคลากร</th>
<th>ประเภท</th>
{{/unless}} {{/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>
@ -30,6 +31,7 @@
<td>{{date}}</td> <td>{{date}}</td>
{{#unless ../personal_name}} {{#unless ../personal_name}}
<td>{{personal_name}}</td> <td>{{personal_name}}</td>
<td>{{personal_type}}</td>
{{/unless}} {{/unless}}
<td style="text-align:right">{{qty}}</td> <td style="text-align:right">{{qty}}</td>
<td style="text-align:right">{{currency amount}}</td> <td style="text-align:right">{{currency amount}}</td>
@ -39,6 +41,7 @@
<tfoot> <tfoot>
{{#unless ../personal_name}} {{#unless ../personal_name}}
<th></th> <th></th>
<th></th>
{{/unless}} {{/unless}}
<th>รวม</th> <th>รวม</th>
<th style="text-align:right">{{total_qty}}</th> <th style="text-align:right">{{total_qty}}</th>

View File

@ -12,9 +12,9 @@
</h4> </h4>
</center> </center>
{{#if lines}} {{#if lines}}
<table class="table"> <table class="table table-condensed table-striped">
<thead> <thead>
<th style="text-align:left;">พยาบาล</th> <th style="text-align:left;" class="col-sm-3">พยาบาล</th>
{{#each cols}} {{#each cols}}
<th style="text-align:right;">{{name}}</th> <th style="text-align:right;">{{name}}</th>
{{/each}} {{/each}}
@ -23,7 +23,7 @@
<tbody> <tbody>
{{#each lines}} {{#each lines}}
<tr> <tr>
<td style="text-align:left;">{{nurse_name}}</td> <td style="text-align:left;" class="col-sm-3">{{nurse_name}}</td>
{{#each sub_lines}} {{#each sub_lines}}
{{#if last}} {{#if last}}
<td style="text-align:right"><b>{{amt}}</b></td> <td style="text-align:right"><b>{{amt}}</b></td>