labor cost report

conv_bal
watcha.h@almacom.co.th 2015-04-05 21:08:37 +07:00
parent 9b65b7cc36
commit d4b3598a99
3 changed files with 21 additions and 8 deletions

View File

@ -59,7 +59,7 @@ class ReportLaborCost(Model):
dom.append(['branch_id','=',branch_id]) dom.append(['branch_id','=',branch_id])
if department_id: if department_id:
dom.append(['department_id','=',department_id]) dom.append(['department_id','=',department_id])
print('dom ', dom) date=date_from
hdcases={} hdcases={}
for hdcase in get_model("clinic.hd.case").search_browse(dom): for hdcase in get_model("clinic.hd.case").search_browse(dom):
dpt=hdcase.department_id dpt=hdcase.department_id
@ -89,13 +89,16 @@ class ReportLaborCost(Model):
elif branch_id: elif branch_id:
branch=get_model("clinic.branch").browse(branch_id) branch=get_model("clinic.branch").browse(branch_id)
sub_name="(%s)" % branch.name or "" sub_name="(%s)" % branch.name or ""
print('>>>>>> :: ', date)
data={ data={
'company_name': '%s %s' % (company.name or "", sub_name), 'company_name': '%s %s' % (company.name or "", sub_name),
'date': date,
'date_from': date_from, 'date_from': date_from,
'date_to': date_to, 'date_to': date_to,
'lines': lines, 'lines': lines,
'total_hdcase': total_hdcase, 'total_hdcase': total_hdcase,
'branch_id': branch_id,
'department_id': department_id,
} }
return data return data

View File

@ -33,14 +33,22 @@ class ReportLaborCostSummary(Model):
def default_get(self,field_names=None,context={},**kw): def default_get(self,field_names=None,context={},**kw):
defaults=context.get("defaults",{}) defaults=context.get("defaults",{})
date=defaults.get("date", time.strftime("%Y-%m-%d"))
print('date>>> ', date)
date_from=defaults.get("date_from", self._get_date_from()) date_from=defaults.get("date_from", self._get_date_from())
date_to=defaults.get("date_to", self._get_date_to()) date_to=defaults.get("date_to", self._get_date_to())
branch_id=int(defaults.get("branch_id","0")) branch_id=defaults.get("branch_id")
department_id=int(defaults.get("department_id","0")) if branch_id:
branch_id=int(branch_id)
department_id=defaults.get("department_id")
if department_id:
department_id=int(department_id)
staff_id=defaults.get('staff_id')
if staff_id:
staff_id=int(staff_id)
staff_type=defaults.get("staff_type","doctor") staff_type=defaults.get("staff_type","doctor")
staff_id=int(defaults.get('staff_id', "0"))
res={ res={
'date': time.strftime("%Y-%m-%d"), 'date': date,
'date_from': date_from, 'date_from': date_from,
'date_to': date_to, 'date_to': date_to,
'staff_type': staff_type, 'staff_type': staff_type,

View File

@ -18,13 +18,15 @@
{{name}} {{name}}
</td> </td>
<td style="text-align:right"> <td style="text-align:right">
<a href="#name=clinic_report_labor_cost_summary&defaults.date_from={{../date_from}}&defaults.date_to={{../date_to}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}">{{currency qty}}</a> <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>
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
</tbody> </tbody>
<tfoot> <tfoot>
<th>Total</th> <th>Total</th>
<th style="text-align:right">{{currency total_hdcase}}</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 total_hdcase}}</a>
</th>
</tfoot> </tfoot>
</table> </table>