show detail

conv_bal
watcha.h@almacom.co.th 2015-04-06 16:40:28 +07:00
parent d355abcda4
commit 8fc70bf7ea
3 changed files with 32 additions and 17 deletions

View File

@ -4,4 +4,5 @@
<field name="date_to" required="1" span="2"/> <field name="date_to" required="1" span="2"/>
<field name="branch_id" onchange="onchange_branch" span="2"/> <field name="branch_id" onchange="onchange_branch" span="2"/>
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/> <field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
<field name="show_detail"/>
</form> </form>

View File

@ -15,6 +15,7 @@ class ReportLaborCost(Model):
"date_to": fields.Date("To", required=True), "date_to": fields.Date("To", required=True),
"branch_id": fields.Many2One("clinic.branch","Branch"), "branch_id": fields.Many2One("clinic.branch","Branch"),
"department_id": fields.Many2One("clinic.department","Department"), "department_id": fields.Many2One("clinic.department","Department"),
'show_detail': fields.Boolean("Show Detail"),
} }
def _get_date_from(self,context={}): def _get_date_from(self,context={}):
@ -35,6 +36,7 @@ class ReportLaborCost(Model):
'date': time.strftime("%Y-%m-%d"), 'date': time.strftime("%Y-%m-%d"),
'date_from': date_from, 'date_from': date_from,
'date_to': date_to, 'date_to': date_to,
'show_detail': False,
} }
return res return res
@ -46,6 +48,7 @@ class ReportLaborCost(Model):
date_to=defaults['date_to'] date_to=defaults['date_to']
branch_id=defaults.get("branch_id") branch_id=defaults.get("branch_id")
department_id=defaults.get("department_id") department_id=defaults.get("department_id")
show_detail=defaults['show_detail']
dom=[] dom=[]
if ids: if ids:
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
@ -53,6 +56,7 @@ class ReportLaborCost(Model):
date_to=obj.date_to date_to=obj.date_to
branch_id=obj.branch_id.id branch_id=obj.branch_id.id
department_id=obj.department_id.id department_id=obj.department_id.id
show_detail=obj.show_detail
dom.append(['date','>=',date_from]) dom.append(['date','>=',date_from])
dom.append(['date','<=',date_to]) dom.append(['date','<=',date_to])
if branch_id: if branch_id:
@ -124,6 +128,7 @@ class ReportLaborCost(Model):
'total_hdcase': total_hdcase, 'total_hdcase': total_hdcase,
'branch_id': branch_id, 'branch_id': branch_id,
'department_id': department_id, 'department_id': department_id,
'show_detail': show_detail,
} }
return data return data

View File

@ -13,28 +13,37 @@
</thead> </thead>
<tbody> <tbody>
{{#each lines }} {{#each lines }}
<tr> {{#if ../show_detail}}
<th>
{{name}}
</th>
<th></th>
</tr>
{{#each sub_lines}}
<tr> <tr>
<td style="text-align:right">{{name}}</td> <th>
{{name}}
</th>
<th></th>
</tr>
{{#each sub_lines}}
<tr>
<td style="text-align:right">{{name}}</td>
<td style="text-align:right">
{{view "link" string=qty action="clinic_hd_case" action_options=action_options}}
</td>
</tr>
{{/each}}
<tr>
<th style="text-align:right">
Subtotal
</th>
<th style="text-align:right">
<a href="#name=clinic_report_labor_cost_summary&defaults.date={{../date}}&defaults.date_from={{../date_from}}&defaults.date_to={{../date_to}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}">{{currency qty}}</a>
</th>
</tr>
{{else}}
<tr>
<td>{{name}}</td>
<td style="text-align:right"> <td style="text-align:right">
{{view "link" string=qty action="clinic_hd_case" action_options=action_options}} {{view "link" string=qty action="clinic_hd_case" action_options=action_options}}
</td> </td>
</tr> </tr>
{{/each}} {{/if}}
<tr>
<th style="text-align:right">
Subtotal
</th>
<th style="text-align:right">
<a href="#name=clinic_report_labor_cost_summary&defaults.date={{../date}}&defaults.date_from={{../date_from}}&defaults.date_to={{../date_to}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}">{{currency qty}}</a>
</th>
</tr>
{{/each}} {{/each}}
</tbody> </tbody>
<tfoot> <tfoot>